codenic_logger 0.3.0 copy "codenic_logger: ^0.3.0" to clipboard
codenic_logger: ^0.3.0 copied to clipboard

outdated

An enhanced logger for providing structured and detailed log messages.

example/main.dart

import 'package:codenic_logger/codenic_logger.dart';

final codenicLogger = CodenicLogger();
final messageLog = MessageLog(
  message: 'Sample message',
  data: <String, dynamic>{'foo': false, 'lorep': 'ipsum'},
);

void main() {
  // To run, type `dart --enable-asserts example/main.dart`.

  verboseWithUserId();
  verbose();
  debug();
  info();
  warn();
  error();
  wtf();
}

void verboseWithUserId() {
  messageLog.details = 'verbose';
  codenicLogger
    ..userId = 'sample-uid'
    ..info(messageLog)
    ..userId = null;
}

void verbose() {
  messageLog.details = 'verbose';
  codenicLogger.verbose(messageLog);
}

void debug() {
  messageLog.details = 'debug';
  codenicLogger.debug(messageLog);
}

void info() {
  messageLog.details = 'info';
  codenicLogger.info(messageLog);
}

void warn() {
  try {
    throw Exception('Test exception');
  } catch (exception, stackTrace) {
    messageLog.details = 'warn';
    codenicLogger.warn(messageLog, error: exception, stackTrace: stackTrace);
  }
}

void error() {
  try {
    throw Exception('Test exception');
  } catch (exception, stackTrace) {
    messageLog.details = 'error';
    codenicLogger.error(messageLog, error: exception, stackTrace: stackTrace);
  }
}

void wtf() {
  try {
    throw Exception('Test exception');
  } catch (exception, stackTrace) {
    messageLog.details = 'wtf';
    codenicLogger.wtf(messageLog, error: exception, stackTrace: stackTrace);
  }
}
6
likes
0
pub points
54%
popularity

Publisher

verified publishercodenic.dev

An enhanced logger for providing structured and detailed log messages.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

logger, meta

More

Packages that depend on codenic_logger