{"id":16401661,"url":"https://github.com/plugfox/l","last_synced_at":"2025-03-21T02:33:05.067Z","repository":{"id":41116287,"uuid":"259739055","full_name":"PlugFox/l","owner":"PlugFox","description":"Cross-platform html/io [L]ogger with simple API.","archived":false,"fork":false,"pushed_at":"2024-12-04T10:27:24.000Z","size":2841,"stargazers_count":37,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-01T02:11:39.086Z","etag":null,"topics":["cross-platform","dart","dart-library","dart-package","dartlang","flutter","html","io","l","log","logger","logging","logging-library","logs","package","pub","wtfpl"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/l","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/PlugFox.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-28T20:02:06.000Z","updated_at":"2024-12-04T10:25:54.000Z","dependencies_parsed_at":"2024-01-19T22:48:47.704Z","dependency_job_id":"3bf56e7f-549e-43cb-b531-6253aabab15c","html_url":"https://github.com/PlugFox/l","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlugFox%2Fl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlugFox%2Fl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlugFox%2Fl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlugFox%2Fl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PlugFox","download_url":"https://codeload.github.com/PlugFox/l/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244102839,"owners_count":20398386,"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":["cross-platform","dart","dart-library","dart-package","dartlang","flutter","html","io","l","log","logger","logging","logging-library","logs","package","pub","wtfpl"],"created_at":"2024-10-11T05:43:48.384Z","updated_at":"2025-03-21T02:33:05.053Z","avatar_url":"https://github.com/PlugFox.png","language":"Dart","readme":"# [L]ogger\n\n\u003c!-- ![](https://github.com/PlugFox/l/raw/master/.img/l.png) --\u003e\n\n[![Pub](https://img.shields.io/pub/v/l.svg)](https://pub.dev/packages/l)\n[![Actions Status](https://github.com/PlugFox/l/actions/workflows/checkout.yml/badge.svg)](https://github.com/PlugFox/l/actions)\n[![Coverage](https://codecov.io/gh/PlugFox/l/branch/master/graph/badge.svg)](https://codecov.io/gh/PlugFox/l)\n[![License: MIT](https://img.shields.io/badge/license-MIT-purple.svg)](https://opensource.org/licenses/MIT)\n[![Linter](https://img.shields.io/badge/style-linter-40c4ff.svg)](https://pub.dev/packages/linter)\n[![GitHub stars](https://img.shields.io/github/stars/plugfox/l?style=social)](https://github.com/plugfox/l/)\n\n## About\n\nCross-platform html/io logger with simple API.\nNo need to create a logger object. Just import and use. Simple and w/o boilerplate.\nWork with native console.\n\n## Core API\n\n### Example of usage\n\n![](example.png)\n[Example of using the library](https://pub.dev/packages/l/example) to display a message in the console.\n\n### Key features\n\n| Method         | Description                          |\n| -------------- | ------------------------------------ |\n| [s]            | A shout is always displayed          |\n| [v1], [v]      | Regular message with verbose level 1 |\n| [e]            | Error message with verbose level 1   |\n| [v2], [vv]     | Regular message with verbose level 2 |\n| [w]            | Warning message with verbose level 2 |\n| [v3], [vvv]    | Regular message with verbose level 3 |\n| [i], [\u003c]       | Inform message with verbose level 3  |\n| [v4], [vvvv]   | Regular message with verbose level 4 |\n| [d], [\u003c\u003c]      | Debug message with verbose level 4   |\n| [v5], [vvvvv]  | Regular message with verbose level 5 |\n| [v6], [vvvvvv] | Regular message with verbose level 6 |\n\n```dart\nl.s('shout me');\nl.e('error msg');\nl.w('warning msg');\nl.i('info msg');\nl \u003c 'alt info msg';\nl.d('debug msg');\nl \u003c\u003c 'alt debug msg';\nl.v('verbose lvl #1');\nl.vv('verbose lvl #2');\nl.vvv('verbose lvl #3');\nl.v4('verbose lvl #4');\nl.v5('verbose lvl #5');\nl.v6('verbose lvl #6');\n```\n\n### Integration capabilities\n\n| Method   | Description                      |\n| -------- | -------------------------------- |\n| [listen] | Broadcast stream receiving logs. |\n\n```dart\n// Broadcast stream instantly receiving logs.\nl.forEach((log) =\u003e print('* ${log.level} : ${log.message}'));\n```\n\n### Print handling and customizing\n\nLogger supports fine-tuning with the second argument ` LogOptions` in a `capture` method.\nAlso, you can handle `print` and output with `l` on some function or in a whole app with this simple syntax:\n\n```dart\nimport 'package:l/l.dart';\n\nvoid main() =\u003e l.capture(\n      someFunction,\n      const LogOptions(\n        handlePrint: true,\n        printColors: true,\n        outputInRelease: false,\n        messageFormatting: _messageFormatting,\n      ),\n    );\n\nFuture\u003cvoid\u003e someFunction() async {\n  print('Hello');\n  await Future\u003cvoid\u003e.delayed(const Duration(milliseconds: 150));\n  l.d('world');\n  await Future\u003cvoid\u003e.delayed(const Duration(milliseconds: 150));\n  l.e('!!!');\n}\n\nObject _messageFormatting(Object message, LogLevel logLevel, DateTime now) =\u003e\n    '${now.hour}:${now.minute.toString().padLeft(2, '0')} $message';\n```\n\n## Handling errors\n\n### Flutter\n\n```dart\nfinal sourceFlutterError = FlutterError.onError;\nFlutterError.onError = (details) {\n  l.w(details.exceptionAsString(), details.stack);\n  sourceFlutterError?.call(details);\n};\n```\n\n### Crashlytics\n\n```dart\nl.where((msg) =\u003e msg.level.maybeWhen(\n      error: () =\u003e true,\n      warning: () =\u003e true,\n      orElse: () =\u003e false,\n    ))\n  .map\u003cString\u003e((msg) =\u003e msg.message.toString())\n  .listen(FirebaseCrashlytics.instance.log);\n```\n\n### Zoned Errors\n\n```dart\nrunZonedGuarded(someFunction, l.e);\n```\n\n### Handling uncaught errors\n\n```dart\nIsolate.current\n       ..setErrorsFatal(false)\n       ..addErrorListener(\n         RawReceivePort(\n           (List\u003cdynamic\u003e pair) =\u003e // ignore: avoid_types_on_closure_parameters\n               l.e(pair.first as Object),\n         ).sendPort,\n       );\n```\n\n## Limitations\n\n- When there is no direct access to the terminal, it works through print.\n- **!!! PLEASE, DO NOT LOG SENSITIVE INFORMATION !!!**\n\n## Changelog\n\nRefer to the [Changelog](https://github.com/plugfox/l/blob/master/CHANGELOG.md) to get all release notes.\n\n## Maintainers\n\n[Plague Fox](https://plugfox.dev)\n\n## Funding\n\nIf you want to support the development of our library, there are several ways you can do it:\n\n- [Buy me a coffee](https://www.buymeacoffee.com/plugfox)\n- [Support on Patreon](https://www.patreon.com/plugfox)\n- [Subscribe through Boosty](https://boosty.to/plugfox)\n\nWe appreciate any form of support, whether it's a financial donation or just a star on GitHub. It helps us to continue developing and improving our library. Thank you for your support!\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n","funding_links":["https://www.buymeacoffee.com/plugfox","https://www.patreon.com/plugfox"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplugfox%2Fl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplugfox%2Fl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplugfox%2Fl/lists"}