Dart library for posting logs to a remote storage. Use together with logging
library.
Features
X
Post log message to remote serverX
Provide custom headersX
Override request bodyX
Retry on errors with exponential timeout
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.