filterable_logger 0.0.7 icon indicating copy to clipboard operation
filterable_logger: ^0.0.7 copied to clipboard

A logger with color output and filters.

Filterable Logger #

pub package

A filterable logger with colored output for different log level.

Features #

  • Log level definition is based on dart logging package.
Level.OFF
Level.SHOUT
Level.SEVERE
Level.WARNING
Level.INFO
Level.CONFIG
Level.FINE
Level.FINER
Level.FINEST
  • Colored output
Colored output
  • Filterable

    To suppress unuseful log info, tags filter will work.

// Set tags filter
FilterableLogger.setup(tagsFilter: <Object>['Network']);

// This will be printed.
FilterableLogger.info('Message', tags: <Object>['Network', 'Debug']);

// This will not be printed
FilterableLogger.info('Message', tags: <Object>['Debug']);

Usage #

// Basic usage
FilterableLogger.shout('This is \'SHOUT\' log.');

FilterableLogger.severe('This is \'SEVERE\' log.');

FilterableLogger.warning('This is \'WARNING\' log.');

FilterableLogger.info('This is \'INFO\' log.');

FilterableLogger.config('This is \'CONFIG\' log.');

FilterableLogger.fine('This is \'FINE\' log.');

FilterableLogger.finer('This is \'FINER\' log.');

FilterableLogger.finest('This is \'FINEST\' log.');
// Logger configurations
FilterableLogger.setup(
  level: Level.INFO,
  showTraceInfo: true,
  traceLevel: 3,
  format: (LogRecord record) {
    return 'Customized log format';
  },
  tagsFilter: <Object>['Filters'],
  afterLogging: (LogRecord record){
    // Callback after log successfully
  },
);