api-docs / org.ktorm.logging / Logger
Logger
interface Logger
(source code)A simple logging interface abstracting third-party logging frameworks.
The logging levels used by Ktorm is defined in the enum class LogLevel in a certain order. While TRACE is
the least serious and ERROR is the most serious. The mapping of these log levels to the concepts used by the
underlying logging system is implementation dependent. The implementation should ensure, though, that this ordering
behaves are expected.
By default, Ktorm auto-detects a logging implementation from the classpath while creating Database instances.
If you want to output logs using a specific logging framework, you can choose an adapter implementation of this
interface and explicitly set the Database.logger property.
Ktorm prints logs at different levels:
- Generated SQLs and their execution arguments are printed at DEBUG level, so if you want to see the SQLs, you
should configure your logging framework to enable the DEBUG level. - Detailed data of every returned entity object are printed at TRACE level, if you want to see them, you should configure your framework to enable TRACE.
- Besides, start-up messages are printed at INFO level, warnings are printed at WARN level, and exceptions are printed at ERROR level. These levels should be enabled by default.
Functions
Name | Summary |
---|---|
Log a message at the DEBUG level. | |
Log a message at the ERROR level. | |
Log a message at the INFO level. | |
abstract fun isDebugEnabled(): Boolean Check if the logger instance enabled for the DEBUG level. | |
abstract fun isErrorEnabled(): Boolean Check if the logger instance enabled for the ERROR level. | |
abstract fun isInfoEnabled(): Boolean Check if the logger instance enabled for the INFO level. | |
abstract fun isTraceEnabled(): Boolean Check if the logger instance enabled for the TRACE level. | |
abstract fun isWarnEnabled(): Boolean Check if the logger instance enabled for the WARN level. | |
Log a message at the TRACE level. | |
Log a message at the WARN level. |
Extension Functions
Name | Summary |
---|---|
infix fun <T : Any> T.eq( Equal operator, translated to | |
infix fun <T : Any> T.neq( Not-equal operator, translated to | |
infix fun <T : Any> T.notEq( Not-equal operator, translated to |
Inheritors
Name | Summary |
---|---|
class AndroidLoggerAdapter : Logger Adapter Logger implementation integrating android.util.Log with Ktorm. | |
class CommonsLoggerAdapter : Logger Adapter Logger implementation integrating Apache Commons Logging with Ktorm. | |
class ConsoleLogger : Logger Simple Logger implementation printing logs to the console. While messages at WARN or ERROR levels are printed to System.err, others are printed to System.out. | |
class JdkLoggerAdapter : Logger Adapter Logger implementation integrating java.util.logging with Ktorm. | |
object NoOpLogger : Logger Logger implementation that performs no operations. | |
class Slf4jLoggerAdapter : Logger Adapter Logger implementation integrating Slf4j with Ktorm. |