A log is a record that contains information about an application's runtime. Logs are useful for the development and debugging of a program.
For more information, read Logging (Software).
An unstructured log — in Software Development — is a log (record) without structure. For example, the Go standard library log
implements unstructured logging.
log.Println("This creates an unstructured log.")
2009/11/10 23:00:00 This creates an unstructured log.
A structured log — in Software Development — is a log (record) with a specified structure (i.e CBOR, JSON). This allows developers to programmatically analyze and process logs.
{"time":1516134303,"level":"info","message":"This is a structured log in the JSON format."}
Disgo uses rs/zerolog
to provide customizable zero-allocation structured logging.
Disgo provides leveled logging of the API Wrapper via the Logger
global variable. As a result, this variable is accessible via disgo.Logger
.
Disgo disables logs by default. Enable them using zerolog.SetGlobalLevel(zerolog.LEVEL)
.
For more information on the usage of zerolog.Logger
, check out its features.
Disgo imports the zerolog
module, letting you use it in your program. As a result, the zerolog
package can be configured from your application.
For more information on the configuration of zerolog
, check out its Global Settings.