Logbook

abstract class Logbook(normalizeName: NameNormalizer = defaultNameNormalizer) : Colorable, CanFormat, HasOutlets(source)

Base class for all logbooks.

Usage

To create your own logbook, create a subclass of Logbook. You can make it an object, but it is recommended to use the following pattern:

abstract class MyLog : Logbook() {
companion object : MyLog()
}

This way, you can create another logger that inherits from your base logger:

abstract class MySpecificLog : MyLog() {
companion object : MySpecificLog()
}

Note

The Logbook class itself comes with the most minimal configuration possible, probably too minimal for you. For this reason, you can choose to use Logbook.WithDefaults instead, which comes preconfigured with four LogLevels – each set up with an AnsiConsoleOutlet – a nice format, and a randomized name color so you can tell different loggers apart. See Logbook.WithDefaults for more info.

Inheritors

Constructors

Link copied to clipboard
constructor(normalizeName: NameNormalizer = defaultNameNormalizer)

Types

Link copied to clipboard
abstract class WithDefaults(nameNormalizer: NameNormalizer = defaultNameNormalizer) : Logbook

Convenience class that provides a lot of useful features that most logbooks will want. You can override anything you don't like, of course.

Properties

Link copied to clipboard
open override var colorInfo: ColorInfo?
Link copied to clipboard
open override var formatter: (LogEntry) -> Iterable<Chunk>?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val name: String
Link copied to clipboard
open override var outlets: MutableSet<LogOutlet>

Functions

Link copied to clipboard
open fun format(entry: LogEntry): Iterable<Chunk>?
Link copied to clipboard
open fun formatWith(formatter: (LogEntry) -> Iterable<Chunk>)
Link copied to clipboard
open fun toChunk(): Chunk