talker_logger

Creator: coderz1093

Last updated:

0 purchases

talker_logger Image
talker_logger Images

Languages

Categories

Add to Cart

Description:

talker logger

talker_logger #
Logger. Easy, customizable, extensible logging, lightweight with filters, formatters, custom logs, log levels.
Core talker package
The package is designed to to make simple and extended logs
Can be used separately from the main parent package
In order to use all the functionality - go to the main page









Get Started #
Follow these steps to use this package
Add dependency #
dependencies:
talker_logger: ^4.4.1
copied to clipboard
Easy to use #
Create TalkerLogger instance and call prepared methods
// Create instance
final logger = TalkerLogger();
// Log messages
logger.debug('debug');
logger.info('info');
logger.critical('critical');
logger.error('error');
logger.good('good');
logger.warning('warning');
logger.verbose('verbose');
logger.log('log with level info', level: LogLevel.info);
logger.log('custom pen log', pen: AnsiPen()..xterm(49));
copied to clipboard
Result

More examples you can get there or in docs
Customization #
This logger has simple settings that can change output
1. Filtering #
final logger = TalkerLogger(
settings: const TalkerLoggerSettings(
// Set current logging level
level: LogLevel.critical,
),
);

// Works as before
logger.critical('critical');
// Does not work
logger.info('info');
copied to clipboard
Result

2. Formating #
Create your own LoggerFormatter implementation
For example - ColoredLoggerFormatter that makes messages only with colors
class ColoredLoggerFormatter implements LoggerFormatter {
@override
String fmt(LogDetails details, TalkerLoggerSettings settings) {
final msg = details.message?.toString() ?? '';
final coloredMsg =
msg.split('\n').map((e) => details.pen.write(e)).toList().join('\n');
return coloredMsg;
}
}
copied to clipboard
And add formatter for TalkerLogger constructor
final logger = TalkerLogger(
formatter: ColoredLoggerFormatter(),
);

logger.debug('debug');
logger.info('info');
logger.warning('warning');
logger.error('error');
copied to clipboard
Result

Or you can make simple customization with default formatters
final logger = TalkerLogger(
settings: TalkerLoggerSettings(
colors: {
LogLevel.critical: AnsiPen()..yellow(),
LogLevel.error: AnsiPen()..yellow(),
LogLevel.info: AnsiPen()..yellow(),
},
maxLineWidth: 20,
lineSymbol: '#',
enableColors: true,
),
);

logger.info('info');
logger.critical('critical');
logger.error('error');
copied to clipboard
Result

Coverage #

More examples you can get here

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.