Logger

interface Logger(source)

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.

Inheritors

Functions

Link copied to clipboard
abstract fun debug(msg: String, e: Throwable? = null)

Log a message at the DEBUG level.

Link copied to clipboard
abstract fun error(msg: String, e: Throwable? = null)

Log a message at the ERROR level.

Link copied to clipboard
abstract fun info(msg: String, e: Throwable? = null)

Log a message at the INFO level.

Link copied to clipboard
abstract fun isDebugEnabled(): Boolean

Check if the logger instance enabled for the DEBUG level.

Link copied to clipboard
abstract fun isErrorEnabled(): Boolean

Check if the logger instance enabled for the ERROR level.

Link copied to clipboard
abstract fun isInfoEnabled(): Boolean

Check if the logger instance enabled for the INFO level.

Link copied to clipboard
abstract fun isTraceEnabled(): Boolean

Check if the logger instance enabled for the TRACE level.

Link copied to clipboard
abstract fun isWarnEnabled(): Boolean

Check if the logger instance enabled for the WARN level.

Link copied to clipboard
abstract fun trace(msg: String, e: Throwable? = null)

Log a message at the TRACE level.

Link copied to clipboard
abstract fun warn(msg: String, e: Throwable? = null)

Log a message at the WARN level.