mirror of
https://github.com/corda/corda.git
synced 2025-05-29 13:44:25 +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)
|
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()
|
init()
|
||||||
loggerRefs[0].handlers[0].level = Level.ALL
|
loggerRefs[0].handlers[0].level = Level.ALL
|
||||||
for (spec in packages) {
|
for (spec in loggerNames) {
|
||||||
val logger = Logger.getLogger(spec)
|
val (name, level) = when (spec[0]) {
|
||||||
logger.level = Level.ALL
|
'+' -> 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)
|
loggerRefs.add(logger)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user