logging_bugfender

logging_bugfender pub.dev badge

A library helping integrate Bugfender with the logging package.

Usage

Setup

final loggingListener = LoggingBugfenderListener('my-very-secret-app-key');

// You probably want it to be INFO on production
Logger.root.level = Level.ALL;
// Listen on root logger
loggingListener.listen(Logger.root);

const logUsernameKey = 'username';

// After the user signs in
loggingListener.setCustomData(logUsernameKey, '<some username>');

// After the user signs out
loggingListener.removeCustomData(logUsernameKey);

Using the logger

class FooBarCubit {
    final _log = Logger('foo_bar_cubit');

    // (...)

    void doSomething() {
        try {
            // (...)
            _log.info('Successfuly did something');
        } catch (e) {
            _log.severe('Failed doing something: $e');
        }
    }
}

Libraries

logging_bugfender
A library integrating Bugfender with the logging package.