cc.otavia.core.slf4a.AbstractLogger.scala Maven / Gradle / Ivy
/*
* Copyright 2022 Yan Kun
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cc.otavia.core.slf4a
import cc.otavia.common.ThrowableUtil
import cc.otavia.core.ioc.ModuleListener
import cc.otavia.core.slf4a.helpers.MessageFormatter
abstract class AbstractLogger extends Logger, Serializable, ModuleListener {
override def trace(format: String, arg: Any): Unit =
if (isTraceEnabled) trace(MessageFormatter.format(format, arg))
override def trace(format: String, arg1: Any, arg2: Any): Unit = ???
override def trace(msg: String, e: Throwable): Unit =
if (isTraceEnabled) trace(s"$msg\n${ThrowableUtil.stackTraceToString(e)}")
override def debug(format: String, arg: Any): Unit = if (isDebugEnabled) debug(s"$format${arg}")
override def debug(format: String, arg1: Any, arg2: Any): Unit = ???
override def debug(msg: String, e: Throwable): Unit =
if (isDebugEnabled) debug(s"$msg\n${ThrowableUtil.stackTraceToString(e)}")
override def info(format: String, arg: Any): Unit = ???
override def info(format: String, arg1: Any, arg2: Any): Unit = ???
override def info(format: String, args: Any*): Unit = ???
override def info(msg: String, e: Throwable): Unit = ???
// if (isInfoEnabled) trace(s"$msg\n${ThrowableUtil.stackTraceToString(e)}")
override def warn(format: String, arg: Any): Unit = ???
override def warn(format: String, arg1: Any, arg2: Any): Unit = ???
override def warn(msg: String, e: Throwable): Unit =
if (isWarnEnabled) this.warn(s"$msg\n${ThrowableUtil.stackTraceToString(e)}")
override def error(format: String, arg: Any): Unit = ???
override def error(format: String, arg1: Any, arg2: Any): Unit = ???
override def error(format: String, args: Any*): Unit = ???
override def error(msg: String, e: Throwable): Unit = ???
// if (isErrorEnabled) trace(s"$msg\n${ThrowableUtil.stackTraceToString(e)}")
}