Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yanshouwang/log_service
https://github.com/yanshouwang/log_service
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/yanshouwang/log_service
- Owner: yanshouwang
- License: mit
- Created: 2023-10-27T12:12:22.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-10-30T09:12:16.000Z (about 1 year ago)
- Last Synced: 2024-10-15T23:11:08.391Z (2 months ago)
- Language: Dart
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# log_service
A Dart package for simplify the usage of the official `logging` package.
## Features
- LogController: An interface for controlling the logger instance.
- LoggerController: A mixin implements the `LogController` interface with a `Logger` instance.
- LoggerProvider: A mixin provides a `Logger` instance, which name is the `runtimeType`.## Getting started
Add `log_service` as a [dependency in your pubspec.yaml file](https://dart.dev/guides/packages).
```
dependencies:
log_service: ^
```## Usage
### 1. Log Levels
The log level is folling the `logging`'s strategy, the `logLevel` is inheirted from the `Logger.root` instance and can only be changed through the `Logger.root` instance by default.
Sets `hierarchicalLoggingEnabled = true` to enable hierarchical logging, then use the `logLevel` of the `LogController` interface to set log level for a specific logger instance.
### 2. Log Events
Listen the `Logger.root.onRecord` stream to get log events.
### 3. Log Methods
- logger.shout();
- logger.severe();
- logger.warning();
- logger.info();
- logger.config();
- logger.fine();
- logger.finer();
- logger.finest();## Additional information
Get more tips form the [`logging`][1] framework.
[1]: https://pub.dev/packages/logging