Skip to content

Logging

Everstray Jun Sinri Edogawa edited this page Oct 10, 2023 · 2 revisions

Keel provides a logging implementation, focusing on Event.

A Log is mapped to an Event

Interface KeelEventLog is designed to record an event in logging, it is marked with a level (check KeelLogLevel for detail), a timestamp and a topic, as well holds an attributes map to bear information.

A Log is produced by a Logger

Interface KeelEventLogger is designed to produce logs for events.

A kind of Logger is maintained by an Log Center

Interface KeelEventLogCenter is designed to maintain loggers, where the loggers are created, cached, and be disposed of along with center itself.

There are three types of Log Center implementaions: sync, async, silent.

Silent

There are two way to obtain a logger instance but not actually log anything.

KeelSilentEventLogger silentEventLogger = KeelSilentEventLogger.getInstance();
silentEventLogger.notice("blind");
            
KeelEventLogger silentLoggerByCenter = KeelSilentEventLogCenter.getInstance().createLogger("silent");
silentLoggerByCenter.notice("blind");

Sync

Class KeelSyncEventLogCenter provides a log center with an adapter (would be introduced later) to handle each log a time, i.e. synchronously.

Async

Class KeelAsyncEventLogCenter provides a log center with an adapter to handle logs in batch, i.e. asynchronously.

The Adapters to actually handle logs

Interface KeelEventLoggerAdapter is the base of any log handlers.

Check package io.github.sinri.keel.logger.event.adapter to see the original implementations.