remote_logger 0.3.0+2 copy "remote_logger: ^0.3.0+2" to clipboard
remote_logger: ^0.3.0+2 copied to clipboard

A listener for logging library to post logs to remote storage.

Dart library for posting logs to a remote storage. Use together with logging library.

Features #

  • ✅ Post log message to remote server
  • ✅ Provide custom headers
  • ✅ Override request body
  • ✅ Retry on errors with exponential timeout
  • ❌ TODO: cache/store information locally

Usage #

void main() {
  Logger.root.level = Level.ALL;

  final logger = Logger('TestLogger');

  // Create remote logger.
  final remoteLogger = RemoteLogger(
    url: Uri.parse('http://example.com'),
    // Optionally, override the body of the request.
    getBody: (record, body) => <String, dynamic>{
      ...body,
      'level': record.level.toString(),
    },
    // Optionally, provide additional headers.
    getHeaders: (headers) => <String, String>{
      ...headers,
      'X-License-Key': 'TEST_KEY',
    },
  );

  // Set remoteLogger as a listener.
  Logger.root.onRecord.listen(remoteLogger);

  // Log a message.
  logger.info('Test message');
}

Additional information #

Please file feature requests and bugs at the issue tracker.

3
likes
160
points
22
downloads

Publisher

verified publishermews.com

Weekly Downloads

A listener for logging library to post logs to remote storage.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

async, http, logging, meta

More

Packages that depend on remote_logger