diff options
author | Piotr Jaszczyk <piotr.jaszczyk@nokia.com> | 2019-01-04 08:50:59 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-01-04 08:50:59 +0000 |
commit | 8b4e282df3863042c69dae60460ec2397e12562e (patch) | |
tree | e8c0b8dff48dedd6653d60ea12090b34fde114ed /sources/hv-collector-utils/src/main | |
parent | 88871ce8d9e069c7967734163c4406d78f91823d (diff) | |
parent | d8a04226845eb71bd8dad384ac4ccd98486d2029 (diff) |
Merge "Change AtLevelLoggers to be initialized by lazy"
Diffstat (limited to 'sources/hv-collector-utils/src/main')
-rw-r--r-- | sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/logging/Logger.kt | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/logging/Logger.kt b/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/logging/Logger.kt index 82ce50a9..ade9b480 100644 --- a/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/logging/Logger.kt +++ b/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/logging/Logger.kt @@ -31,11 +31,21 @@ class Logger(logger: org.slf4j.Logger) { constructor(clazz: KClass<out Any>) : this(LoggerFactory.getLogger(clazz.java)) constructor(name: String) : this(LoggerFactory.getLogger(name)) - private val errorLogger = if (logger.isErrorEnabled) ErrorLevelLogger(logger) else OffLevelLogger - private val warnLogger = if (logger.isWarnEnabled) WarnLevelLogger(logger) else OffLevelLogger - private val infoLogger = if (logger.isInfoEnabled) InfoLevelLogger(logger) else OffLevelLogger - private val debugLogger = if (logger.isDebugEnabled) DebugLevelLogger(logger) else OffLevelLogger - private val traceLogger = if (logger.isTraceEnabled) TraceLevelLogger(logger) else OffLevelLogger + private val errorLogger by lazy { + if (logger.isErrorEnabled) ErrorLevelLogger(logger) else OffLevelLogger + } + private val warnLogger by lazy { + if (logger.isWarnEnabled) WarnLevelLogger(logger) else OffLevelLogger + } + private val infoLogger by lazy { + if (logger.isInfoEnabled) InfoLevelLogger(logger) else OffLevelLogger + } + private val debugLogger by lazy { + if (logger.isDebugEnabled) DebugLevelLogger(logger) else OffLevelLogger + } + private val traceLogger by lazy { + if (logger.isTraceEnabled) TraceLevelLogger(logger) else OffLevelLogger + } // ERROR |