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

outdated

An extended logger for providing detailed log messages.

example/main.dart

import 'package:codenic_logger/codenic_logger.dart';

final codenicLogger = CodenicLogger();
const messageLog = MessageLog(message: 'Sample message');

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

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

void verboseWithUserId() {
  codenicLogger.userId = 'sample-uid';
  codenicLogger.info(
    messageLog.copyWith(details: 'verbose'),
    data: {'foo': false, 'lorep': 'ipsum'},
  );
  codenicLogger.userId = null;
}

void verbose() {
  codenicLogger.verbose(
    messageLog.copyWith(details: 'verbose'),
    data: {'foo': false, 'lorep': 'ipsum'},
  );
}

void debug() {
  codenicLogger.debug(
    messageLog.copyWith(details: 'debug'),
    data: {'foo': false, 'lorep': 'ipsum'},
  );
}

void info() {
  codenicLogger.info(
    messageLog.copyWith(details: 'info'),
    data: {'foo': false, 'lorep': 'ipsum'},
  );
}

void warn() {
  try {
    throw Exception('Test exception');
  } catch (exception, stackTrace) {
    codenicLogger.warn(
      messageLog.copyWith(details: 'warn'),
      data: {'foo': false, 'lorep': 'ipsum'},
      error: exception,
      stackTrace: stackTrace,
    );
  }
}

void error() {
  try {
    throw Exception('Test exception');
  } catch (exception, stackTrace) {
    codenicLogger.error(
      messageLog.copyWith(details: 'error'),
      data: {'foo': false, 'lorep': 'ipsum'},
      error: exception,
      stackTrace: stackTrace,
    );
  }
}

void wtf() {
  try {
    throw Exception('Test exception');
  } catch (exception, stackTrace) {
    codenicLogger.wtf(
      messageLog.copyWith(details: 'What the f---'),
      data: {'foo': false, 'lorep': 'ipsum'},
      error: exception,
      stackTrace: stackTrace,
    );
  }
}
6
likes
0
pub points
54%
popularity

Publisher

verified publishercodenic.dev

An extended logger for providing detailed log messages.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

logger, meta

More

Packages that depend on codenic_logger