mirror of
https://github.com/corda/corda.git
synced 2025-04-07 19:34:41 +00:00
Minor: make BriefLogFormatter.initVerbose take a set of flags saying what logging to activate vs silence.
This commit is contained in:
parent
6c4825aeb2
commit
c35d7794d8
@ -71,12 +71,22 @@ class BriefLogFormatter : Formatter() {
|
||||
loggerRefs.add(logger)
|
||||
}
|
||||
|
||||
fun initVerbose(vararg packages: String) {
|
||||
/**
|
||||
* Takes a set of strings identifying logger names for which the logging level should be configured.
|
||||
* If the logger name starts with a + or an ordinary character, the level is set to [Level.ALL]. If it starts
|
||||
* with a - then logging is switched off.
|
||||
*/
|
||||
fun initVerbose(vararg loggerNames: String) {
|
||||
init()
|
||||
loggerRefs[0].handlers[0].level = Level.ALL
|
||||
for (spec in packages) {
|
||||
val logger = Logger.getLogger(spec)
|
||||
logger.level = Level.ALL
|
||||
for (spec in loggerNames) {
|
||||
val (name, level) = when (spec[0]) {
|
||||
'+' -> spec.substring(1) to Level.FINEST
|
||||
'-' -> spec.substring(1) to Level.OFF
|
||||
else -> spec to Level.ALL
|
||||
}
|
||||
val logger = Logger.getLogger(name)
|
||||
logger.level = level
|
||||
loggerRefs.add(logger)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user