Skip to content

The Dlog Package

Patrick Stephen edited this page Dec 4, 2021 · 3 revisions

Oak internally has all of it's debug and logging calls go through the dlog package.

The Default Logger

The default logger in dlog will write to os.Stdout. This can be augmented with additional outputs like a log file via dlog.SetOutput.

The default logger supports three levels of logging: Verb, Info, and Error, and will only output messages that match a customizable filter function (via SetFilter). The initial error level and string filter are set through the oak.Config object when oak.Init is called.

Replacing the Default Logger

Replace the top-level dlog.DefaultLogger to implement your own logger (or point oak at a logging solution like logrus or zerolog).