{"id":15008683,"url":"https://github.com/mrgnhnt96/flog","last_synced_at":"2025-07-27T13:09:58.481Z","repository":{"id":56828930,"uuid":"354927460","full_name":"mrgnhnt96/flog","owner":"mrgnhnt96","description":"A feature based logging library that helps filter logs and keep the console clean.","archived":false,"fork":false,"pushed_at":"2021-06-16T17:02:38.000Z","size":126,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-10T05:32:02.710Z","etag":null,"topics":["console","dart","dart-library","dartlang","flutter","flutter-package","logging","print"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrgnhnt96.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2021-04-05T18:10:57.000Z","updated_at":"2024-03-01T09:37:52.000Z","dependencies_parsed_at":"2022-08-26T13:51:22.897Z","dependency_job_id":null,"html_url":"https://github.com/mrgnhnt96/flog","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mrgnhnt96/flog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrgnhnt96%2Fflog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrgnhnt96%2Fflog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrgnhnt96%2Fflog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrgnhnt96%2Fflog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrgnhnt96","download_url":"https://codeload.github.com/mrgnhnt96/flog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrgnhnt96%2Fflog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265402609,"owners_count":23759190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["console","dart","dart-library","dartlang","flutter","flutter-package","logging","print"],"created_at":"2024-09-24T19:20:00.443Z","updated_at":"2025-07-15T04:08:25.624Z","avatar_url":"https://github.com/mrgnhnt96.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/mrgnhnt96/flog/blob/master/assets/images/flog.png?raw=true\" height=\"100\" alt=\"flog\" /\u003e\n\u003c/p\u003e\n\n---\n\nA feature based logging library that helps filter logs and keep the console clean.\n\n---\n\n## Overview\n\nThe goal of this package is to maintain a clean console by filtering logs based on features.\n\nThis allows to keep all logs, and to optionally allow *featured specific* logs to print to console.\n\nFlog enables customization to printed logs, by changing its color, boldness, and background. Making it easy to spot different logs types.\n\nFlog has an open API to easily integrate any analytic tools or services, by using its `delegate` feature.\n\n---\n\n## Getting Started\n\n### Set Up\n\nAlthough Flog works right without any initial set up, the API is open to set up logs.\n\n```dart\nFlog.setUp(\n    label: String Function(DateTime date, String tag, String? feature)\n    allowLog: bool Function(),\n    ansiColorDisabled: bool,\n    useCleanStackTrace: bool,\n    formats: FlogFormats(\n      error: StatementFormat(\n        backgroundColor: BackgroundColor(FlogColors, {RGB rgb}),\n        textFormat: TextFormat(FlogColors, {bool isBold = false, RGB rgb})\n      ),\n      fatal: StatementFormat,\n      important: StatementFormat,\n      info: StatementFormat,\n      nav: StatementFormat,\n      state: StatementFormat,\n    ),\n  );\n```\n---\n\n### Label\nA string will be inserted as a prefix to each log. Provides the time stamp, the tag (type of log), and the feature (if provided, returns `null` if none).\n\nBy default, the label uses only [tag].\n\n---\n\n### Allow Log\nA check before every log. This is helpful to only print in development or profile modes. Printing should be avoided in release mode.\n\n***note:*** Allow log only affects printing to console, the delegate will still be called for every log.\n\ndefault:\n```dart\n.allowLog = () {\n  if (kDebugMode) return true;\n  if (kProfileMode) return true;\n  if (kReleaseMode) return false;\n  return false;\n};\n```\n\n---\n\n### Ansi Color Disabled\nFlog depends on AnsiColor to customize print statements. If customization is not working, try changing this value.\n\nReference https://pub.dev/packages/ansicolor for more info.\n\ndefault:\n```dart\n.ansiColorDisabled = false,\n```\n\n---\n\n### Use Clean Stack Trace\nFlog depends on stack_trace to clean stack traces provided for `flogFatal` and `flogError`. To use Darts original Stack Trace, set to `false`.\n\ndefault:\n```dart\n.useCleanStackTrace = true,\n```\n\n---\n\n### Formats\nCustomize how each log looks in console to easily distinguish between each different log type.\n\nSet formats, or a specific log type, to `null` to use the default console's settings.\n\ndefault:\n```dart\n.formats = null,\n```\n\nAvailable Colors:\n\n```dart\nFlogColors {\n  black,\n  blue,\n  cyan,\n  gray,\n  green,\n  red,\n  white,\n  yellow,\n  custom,\n}\n```\n\nTo use a custom color, use `FlogColors.custom` and provide an [RGB]\n```dart\nStatementFormat(\n    textFormat: TextFormat(\n        FlogColors.custom,\n        rgb: const RGB(red: 89, blue: 231, green: 245),\n        isBold: true,\n    ),\n),\n```\n\n***note:*** To quickly test your formats, you can call:\n```dart\nFlog.runFormatTest();\n```\n\n---\n---\n\n## Filtering\n\nFlog has the ability to filter specific logs to the console.\n\n```dart\nFlog.filter(\n    List\u003cObject\u003e?,\n    allowNav: bool,\n    allowState: bool,\n  );\n```\n\nTo show all logs:\n```dart\n// by default, or by setting null, all logs will be shown\nFlog.filter(null);\n```\n\nFeatures can be any type. enum, num, String, ect.\n\nExample:\n\n```dart\nenum Filter {\n    one,\n    two,\n}\n\nvoid main() {\n    Flog.filter([Filter.one]);\n\n    flogInfo('this will always be printed');\n    flogInfo('this will NOT be printed', Filter.two);\n    flogInfo('this WILL be printed', Filter.one);\n}\n```\n\n---\n\n### Allow State\n\nYou have the ability to override all state logs. \n`false` will disable all state logs,\n`true` will enable all state logs, still filterable by features.\n\n```dart\n//default = true\nFlog.filter(..., allowState: bool);\n```\n\n---\n\n### Allow Nav\n\nYou have the ability to override all nav logs. \n`false` will disable all nav logs,\n`true` will enable all nav logs.\n\n```dart\n//default = true\nFlog.filter(..., allowNav: bool);\n```\n\n---\n---\n\n## Log Types\n\nThere are 6 different logs available\n\n\u003e state, nav, info, important, error, fatal\n\n---\n\n### State\n\n```dart\nflogState(Object? message, [Object? feature]);\n```\n\nThis is intended for all state changes with your choice of State Management Provider.\n\nYou can pass an optional parameter, [feature], to add a Feature specific filter. If no feature is provided, it will always print to console. By providing a feature, the log with ***always*** show, unless `Flog.filter(...)` contains a value.\n\n---\n\n### Nav\n\n```dart\nflogNav(Object? message);\n```\n\nThis is intended for all navigation changes.\n\n---\n\n### Info\n\n```dart\nflogInfo(Object? message, [Object? feature]);\n```\n\nThis is similiar to the basic print statement. All dev, testing, and non-important logs.\n\nYou can pass an optional parameter, [feature], to add a Feature specific filter.\n\n---\n\n### Important\n\n```dart\nflogImportant(Object? message);\n```\n\nThis is intended for all important logs, logs that may require additional attention.\n\nUse cases:\n- Unexpected events\n- Significant info\n- Unwanted events\n\n---\n\n### Error\n\n```dart\nflogError(Object? object, [dynamic stackTrace]);\n```\n\nThis is intended for logs of an exception or an undesired result.\n\n---\n\n### Fatal\n\n```dart\nflogFatal(Object? object, [dynamic stackTrace]);\n```\n\nThis is intended for logs that represent an irreparable situation.\n\n---\n---\n\n## Observing logs\n\nEach corresponding log type has a delegate that can be used to incorporate analytics or services.\n\n```dart\nFlog.delegate = FlogDelegate(\n    flogState: void Function(Object? object, [Object? feature]),\n    flogNav: void Function(Object? object),\n    flogInfo: void Function(Object? object, [Object? feature]),\n    flogImportant: void Function(Object? object),\n    flogError: void Function(Object? object, [dynamic stackTrace]),\n    flogFatal: void Function(Object? object, [dynamic stackTrace]),\n);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrgnhnt96%2Fflog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrgnhnt96%2Fflog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrgnhnt96%2Fflog/lists"}