pvlogger 0.9.2 copy "pvlogger: ^0.9.2" to clipboard
pvlogger: ^0.9.2 copied to clipboard

A powerful and flexible logging utility for Dart applications

example/example.dart

import 'package:pvlogger/pvlogger.dart';
import 'package:pvlogger/templates/print.dart';

void main() async {
  // Create a simple logger
  final logger = quickLogger('MyDartApp', nicePrint: true);

  // Basic logging
  await logger.log('Application started');
  logger.logSync('This is a sync message');

  // Scoped logging
  await logger.log('User logged in', scopes: ['auth', 'security']);

  // Error handling
  try {
    throw Exception('Something went wrong');
  } catch (error, stackTrace) {
    if (error is Exception) {
      await logger.catchError(error, stackTrace, 'Failed to process data');
    }
  }

  // Child loggers
  final dbLogger = logger.child('database');
  await dbLogger.log('Connection established');

  // Custom logger with different settings
  final debugLogger = PVLogger('debug', scopes: ['development']);
  debugLogger.level = 2;

  PVLogger.registerAdapter(PVStdFormatter());
  PVLogger.registerAdapter(PVLogJustPrinter(level: 1));

  await debugLogger.log('Debug information', scopes: ['trace']);
}
0
likes
160
points
10
downloads

Publisher

verified publisherpathverse.ca

Weekly Downloads

A powerful and flexible logging utility for Dart applications

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on pvlogger