Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mono0926/simple_logger
Provides super simple APIs for logging. The log also includes caller info by setting includeCallerInfo to true. On Android Studio, jump to caller info by clicking the log.
https://github.com/mono0926/simple_logger
caller caller-info customizable dart log-level logger logging simple
Last synced: 1 day ago
JSON representation
Provides super simple APIs for logging. The log also includes caller info by setting includeCallerInfo to true. On Android Studio, jump to caller info by clicking the log.
- Host: GitHub
- URL: https://github.com/mono0926/simple_logger
- Owner: mono0926
- License: mit
- Created: 2018-12-16T10:10:51.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-10-07T06:43:18.000Z (4 months ago)
- Last Synced: 2025-01-14T03:07:26.860Z (8 days ago)
- Topics: caller, caller-info, customizable, dart, log-level, logger, logging, simple
- Language: Dart
- Homepage: https://pub.dartlang.org/packages/simple_logger
- Size: 88.9 KB
- Stars: 56
- Watchers: 4
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# simple_logger
Provides super simple APIs for logging. The log also includes caller info by setting includeCallerInfo to true. On Android Studio, jump to caller info by clicking the log.
## Usage
```dart
// Singleton (factory)
final logger = SimpleLogger();// Printed without called location
logger.info('Hello info!');
// -> ๐ป INFO 2018-12-16 21:46:20.092695 [caller info not available] Hello info!// Printed function which returns object
logger.info(() => 'Hello info!');
// -> ๐ป INFO 2018-12-16 21:46:20.092695 [caller info not available] Hello info!logger.setLevel(Level.WARNING);
// Not printed
logger.info('Hello info!');// Printed
logger.warning('Hello warning!');
// -> โ ๏ธ WARNING 2018-12-16 21:46:20.101114 [caller info not available] Hello warning!logger.shout('Hello shout!');
// -> ๐ก SHOUT 2018-12-16 21:46:20.101308 [caller info not available] Hello shout!logger.setLevel(
Level.INFO,
// Includes caller info, but this is expensive.
includeCallerInfo: true,
);// Printed with called location
logger.info('Hello info!');
// -> ๐ป INFO 2018-12-16 21:50:03.562583 [example/simple_logger_example.dart 29:10 in main] Hello info!// Customize level prefix
logger.levelPrefixes = {};
logger.info('Hello info!');
// -> INFO 2018-12-16 21:50:03.562583 [example/simple_logger_example.dart 29:10 in main] Hello info!logger.formatter = (info) => 'Customized output: (${info.message})';
logger.info('Hello info!');
// -> Customized output: (Hello info!)logger.onLogged = (info) => print('Insert your logic with $info');
logger.info('Hello info!');
// -> Customized output: (Hello info!)
// -> Insert your logic with Instance of 'LogInfo'
```## Technical Articles
- [Dartใฎใญใฐๅบๅใซๅผใณๅบใๅ ใฎๆ ๅ ฑใๅซใใฆใฏใชใใฏใง้ฃในใใใใซใใ โ Flutter ๐ฏ๐ต โ Medium](https://medium.com/flutter-jp/logger-ec25d8dd179a)
## Features and bugs
Please file feature requests and bugs at the [issue tracker][tracker].
[tracker]: https://github.com/mono0926/simple_logger/issues