talker 0.4.0 copy "talker: ^0.4.0" to clipboard
talker: ^0.4.0 copied to clipboard

outdated

Advanced error handler and logger package for flutter and dart apps

example/talker_example.dart

import 'package:talker/talker.dart';

class HttpTalkerLog extends TalkerLog {
  HttpTalkerLog(String message) : super(message);

  @override
  AnsiPen get pen => AnsiPen()..xterm(49);

  @override
  String generateTextMessage() {
    return pen.write(message);
  }
}

Future<void> main() async {
  await Talker.instance.configure(
    settings: const TalkerSettings(
      registeredTypes: [HttpTalkerLog],
    ),
  );

  try {
    throw Exception('Test service exception');
  } catch (e, st) {
    Talker.instance.handle(e, 'Working with string error', st);
  }

  try {
    throw Exception('Service can`t get test data');
  } on Exception catch (e, st) {
    Talker.instance.handleException(e, 'Working with strings exception', st);
  }

  Talker.instance.log(
    'Server error',
    logLevel: LogLevel.critical,
    additional: {
      "status": 500,
      "error": "Internal Server Error",
    },
  );

  Talker.instance.fine('Log fine');
  Talker.instance.error('Log error');
  Talker.instance.good('Log good');
  Talker.instance.verbose('Log verbose');
  Talker.instance.warning('Log warning');
  Talker.instance.critical('Log critical');

  final httpLog = HttpTalkerLog('Http good');
  Talker.instance.logTyped(httpLog);
}
576
likes
0
pub points
96%
popularity

Publisher

verified publisherfrezycode.com

Advanced error handler and logger package for flutter and dart apps

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

intl, talker_error_handler, talker_logger

More

Packages that depend on talker