Logs that makes you wow! For both IDE Terminal and Device Console Stream.
Wrapper of logger with built-in pretty print and in the format that accomodates to the methods and structure of logging.
- Import the package:
pretty_logger:
git: git@github.com:stencilman/pretty_logger.git- Import in your project
import 'package:pretty_logger/pretty_logger.dart';- Initialise the
LogHandlerin the beginning ofmain.dart:
void main() {
LogHandler.init();
...
}And dispose it in ur first screen under Material
@override
void dispose() {
LogHandler.dispose();
super.dispose();
}- Now just call like this:
log.info(yourAnyMessage);There are many level of logs with the priority:
finest() < finer() < fine() < info() < warning() < severe() < shout()
finest() is for most useless information and shout() is for the most important information that requires immediate attention.
- Set your levels like:
log.level = Level.info;When the log is set at a particular level it only shows the logs of priority >= to that level. So for example, setting it to Level.info will hide logs of fine() and so on, and show only from info() to shout()
- You can listen to the logs in any
StreamBuilder
stream: LogHandler.logRecordsStream,You can retrive the printable text from the snapshot data using:
String printableText = LogHandler.formatLogRecord(yourSnapshotData);Level.finest -> Level.verbose
Level.finer -> Level.trace
Level.fine -> Level.debug
Level.info -> Level.info
Level.warning -> Level.warning
Level.severe -> Level.error
Level.shout -> Level.fatal