Created
July 26, 2020 10:35
-
-
Save AlexMeuer/1575f5b88144f287d6396175306d6dbd to your computer and use it in GitHub Desktop.
copy-pastable injectable logger config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:injectable/injectable.dart'; | |
import 'package:logger/logger.dart'; | |
@module | |
abstract class LoggingModule { | |
@lazySingleton | |
Logger get logger; | |
@dev | |
@injectable | |
Level levelDev() => Level.verbose; | |
@test | |
@injectable | |
Level levelTest() => Level.info; | |
@prod | |
@injectable | |
Level levelProd() => Level.wtf; | |
@injectable | |
LogFilter filter() => ProductionFilter(); | |
@dev | |
@injectable | |
LogPrinter printerDev() => SimplePrinter(colors: false); | |
@test | |
@injectable | |
LogPrinter printerTest() => SimplePrinter(colors: false, printTime: true); | |
@prod | |
@injectable | |
LogPrinter printerProd() => LogfmtPrinter(); | |
@injectable | |
LogOutput output() => ConsoleOutput(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment