logging_bugfender

Last updated:

0 purchases

logging_bugfender Image
logging_bugfender Images
Add to Cart

Description:

logging bugfender

logging_bugfender #


A library helping integrate Bugfender with the logging package.
Usage #
Setup #
final loggingListener = LoggingBugfenderListener('my-very-secret-app-key');

void main() {
setupLogger(true);
// ...
runApp(MyApp());
}

void setupLogger(bool debugMode) {
if (debugMode) {
// During debugging, you'll usually want to log everything
Logger.root.level = Level.ALL;
LoggingBugfenderListener(
config.bugfenderKey,
consolePrintStrategy: const PlainTextPrintStrategy(),
).listen(Logger.root);
} else {
// On production, you probably want to log only INFO and above
Logger.root.level = Level.INFO;
LoggingBugfenderListener(config.bugfenderKey).listen(Logger.root);
}
}
copied to clipboard
Custom data #
You can also add and remove custom data.
const logUsernameKey = 'username';

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

// After the user signs out
loggingListener.removeCustomData(logUsernameKey);
copied to clipboard
In a cubit #
class FooBarCubit {
final _logger = Logger('FooBarCubit');

// (...)

void doSomething() {
try {
// (...)
_logger.info('Successfuly did something');
} catch (err, st) {
_logger.severe('Failed doing something', err, st);
}
}
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.