{"id":27061185,"url":"https://github.com/levin-riegner/logging_flutter","last_synced_at":"2025-07-26T23:36:54.306Z","repository":{"id":41339459,"uuid":"363975113","full_name":"levin-riegner/logging_flutter","owner":"levin-riegner","description":"Flutter extension for the official logging package.","archived":false,"fork":false,"pushed_at":"2023-06-30T18:40:48.000Z","size":514,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-01T09:02:24.574Z","etag":null,"topics":["dart","flutter","logger","logging","logging-library"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/logging_flutter","language":"Dart","has_issues":false,"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/levin-riegner.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-03T15:27:01.000Z","updated_at":"2024-05-13T21:01:58.000Z","dependencies_parsed_at":"2025-01-01T09:00:50.013Z","dependency_job_id":"73d03e89-4437-4945-9ade-ff4ced2fcea4","html_url":"https://github.com/levin-riegner/logging_flutter","commit_stats":{"total_commits":22,"total_committers":7,"mean_commits":3.142857142857143,"dds":0.5909090909090908,"last_synced_commit":"abb7e8a3bc9c749ded149e025b792f5bf08ed176"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levin-riegner%2Flogging_flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levin-riegner%2Flogging_flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levin-riegner%2Flogging_flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levin-riegner%2Flogging_flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/levin-riegner","download_url":"https://codeload.github.com/levin-riegner/logging_flutter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247346491,"owners_count":20924219,"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":["dart","flutter","logger","logging","logging-library"],"created_at":"2025-04-05T14:19:47.795Z","updated_at":"2025-04-05T14:19:48.359Z","avatar_url":"https://github.com/levin-riegner.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logging Flutter\n\nFlutter extension for the [logging](https://pub.dev/packages/logging) package.\n\n## Overview\n\nThis package provides a simple tool for logging messages in your applications and a set of additional utilities.\n\n## Features\n\n- Print logs to the console using a standard format.\n- Send logs to 3rd party services (ie: Crashlytics, DataDog, etc.)\n- Print class and method names where the log was triggered.\n- View and share all logs from inside the app.\n- Capture and format [logging](https://pub.dev/packages/logging) logs from 3rd party packages.\n\n## Get Started\n\n### Initializing\n\nUse the [Flogger](lib/src/flogger.dart) static class to access all logging methods.\n\n1. Initialize the logger.\n\n    ```dart\n    Flogger.init();\n    ```\n\n1. Register a listener to print logs to the developer console.\n\n    ```dart\n    if (kDebugMode){\n        Flogger.registerListener(\n            (record) =\u003e log(record.printable(), stackTrace: record.stackTrace),\n        );\n    }\n    ```\n\n### Logging messages\n\nLog messages with their severity using the following methods:\n\n```dart\nFlogger.d(\"Debug message\");\nFlogger.i(\"Info message\");\nFlogger.w(\"Warning message\");\nFlogger.e(\"Error message\", stackTrace: null);\n```\n\nThese calls will result in the logs below when using the default configuration:\n\n```console\n[log] D/App SampleClass: Debug message\n[log] I/App SampleClass: Info message\n[log] W/App SampleClass: Warning message\n[log] E/App SampleClass: Error message\n```\n\n### Advanced Usage\n\n#### Configuration\n\nUse the [FloggerConfig](lib/src/flogger.dart) class when initializing the Flogger to configure how logs are printed:\n\n```dart\nFlogger.init(config: FloggerConfig(...));\nFloggerConfig({\n    // The name of the default logger\n    this.loggerName = \"App\",\n    // Print the class name where the log was triggered\n    this.printClassName = true,\n    // Print the method name where the log was triggered\n    this.printMethodName = false,\n    // Print the date and time when the log occurred\n    this.showDateTime = false,\n    // Print logs with Debug severity\n    this.showDebugLogs = true,\n    // Print logs with a custom format\n    // If set, ignores all other print options\n    final FloggerPrinter? printer,\n});\n```\n\n#### Viewing logs inside the app\n\nUse the [LogConsole](lib/src/log_console.dart) class to view your logs inside the app.\n\n1. Add logs to the console buffer by registering a new listener.\n\n    ```dart\n    Flogger.registerListener(\n      (record) =\u003e LogConsole.add(\n          OutputEvent(record.level, [record.printable()]),\n          bufferSize: 1000, // Remember the last X logs\n      ),\n    );\n    ```\n\n1. Open the logs console to view all recorded logs.\n\n    ```dart\n    LogConsole.open(context)\n    ```\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Log console light\" src=\"doc/static/log_console_light.png\" width=\"45%\"\u003e\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;\n  \u003cimg alt=\"Log console dark\" src=\"doc/static/log_console_dark.png\" width=\"45%\"\u003e\n\u003c/p\u003e\n\n#### Multiple Loggers\n\nUse the `loggerName` parameter when adding logs to print them as a different logger. This can be useful for differentiating calls made from the different layers in your app. For example:\n\n```dart\n    Flogger.i(\"Info message\", loggerName: \"Network\");\n    Flogger.w(\"Warning message\", loggerName: \"Database\");\n```\n\n#### Logging to 3rd party services\n\nRegister additional listeners to send logs to different services, for example:\n\n```dart\nif (kReleaseMode) {\n    Flogger.registerListener((record) {\n        // Filter logs that may contain sensitive data\n        if(record.loggerName != \"App\") return;\n        if(record.message.contains(\"apiKey\")) return;\n        if(record.message.contains(\"password\")) return;\n        // Log to 3rd party services\n        FirebaseCrashlytics.instance.log(record.printable());\n        DatadogSdk.instance.logs?.info(record.printable());\n    });\n}\n```\n\n## Contributing\n\nContributions are most welcome! Feel free to open a new issue or pull request to make this project better.\n\n## Deployment\n\n1. Set the new version on the [pubspec.yaml](pubspec.yaml) `version` field.\n2. Update the [CHANGELOG.md](CHANGELOG.md) file documenting the changes.\n3. Update the [README.md](README.md) file if necessary.\n4. Run `dart doc` to update the documentation.\n5. Run `dart pub publish --dry-run` to ensure the package can be published successfully.\n6. Create a new tag with the release version `git tag -a x.y.z -m \"x.y.z\" \u0026\u0026 git push --tags`.\n7. Navigate to [GitHub Releases](https://github.com/levin-riegner/logging_flutter/releases) and create a new release for the previously created tag, including the [CHANGELOG.md](CHANGELOG.md) changes.\n8. Finally run `dart pub publish` to deploy the project.\n\n## Credits\n\n- [Logging](https://github.com/dart-lang/logging) - Copyright (c) 2013 the Dart project authors [BSD 3-Clause](https://github.com/dart-lang/logging/blob/master/LICENSE) for providing the logging framework this library depends on.\n- [Logger Flutter](https://github.com/leisim/logger_flutter) - Copyright (c) 2019 Simon Leier [MIT License](https://github.com/leisim/logger_flutter/blob/master/LICENSE) for creating the log console.\n\n## License\n\nThis repo is covered under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevin-riegner%2Flogging_flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevin-riegner%2Flogging_flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevin-riegner%2Flogging_flutter/lists"}