global_logger library
This library provides a global logger for easy logging across your application.
Usage:
import 'package:strlog/global_logger.dart';
The global logger is preconfigured with:
- Severity level: Level.debug
- Handler: ConsoleHandler with
TextFormatter.defaultFormatter
Even-thought the global logger comes fully configured, it is possible to override it via set. It might be particulary useful to specify configured logger once at the main entrypoint and use it as sigleton across the app.
Properties
Functions
-
debug(
String message, [Iterable< Field> ? fields]) → void - Logs a debug message.
-
error(
String message, [Iterable< Field> ? fields]) → void - Logs a error (error) message.
-
fatal(
String message, [Iterable< Field> ? fields]) → void - Logs a fatal message.
-
info(
String message, [Iterable< Field> ? fields]) → void - Logs an info message.
-
log(
Level level, String message, [Iterable< Field> ? fields]) → void - Logs a message with the specified severity level.
-
set(
Logger logger) → void -
startTimer(
String message, {Level level = Level.debug}) → Timer - Starts a timer and logs a message. Returns a Timer object.
-
warn(
String message, [Iterable< Field> ? fields]) → void - Logs a warn message.
-
withFields(
Iterable< Field> fields) → Interface - Creates a new logging context with additional fields.