github.com/senzing/go-logging (go): The Senzing go-logging packages build a composable logging system that sits on top of Go's log package (https://pkg.go.dev/log).  The Senzing go-logging packages use the message number to coordinate aspects of the log message such as message identification, message text, status, and logging level.  go-logging also allows different formatting options such as JSON or simply terse messages.  go-logging extends the levels of logging to include: Trace, Debug, Info, Warn, Error, Fatal, and Panic.  go-logging implements "guards", e.g. IsXxxxx() methods, to avoid calling a Log() method that wouldn't print anyway because of the logging level. For instance, there's no reason to call a DEBUG Log() method when the logging level is set to INFO.  Guards prevent this. Example:  The basic use of senzing/go-logging looks like this:  Output:  The following examples can be seen in actual code at https://github.com/Senzing/go-logging/blob/main/main.go  In each of the following examples, the following imports are assumed:  -- Configure log --------------------------------------------------------------  The Go "log" package can be independently configured. Example:  Output:  -- Customize the id field -----------------------------------------------------  To create a unique identifier, not just an integer, a go format string (https://pkg.go.dev/fmt) can be used as an ID template. Example:  Output:  -- Log additional information -------------------------------------------------  In addition to a message identification integer, other types can be logged. Example:  Output:  The fields submitted in the Log() call are seen in a map in the log message. They will be listed in the order specified in the Log() call.  -- Adding a text field --------------------------------------------------------  The additional information that is submitted in a Log() call can be used to create a text message. By mapping message numbers to format strings, the Log() call will create formatted text output. Example:  Output:  Notice that the information used to build the formatted text still remains in the map. This is by design.  -- Log level ------------------------------------------------------------------  A log level can be specified anywhere after the first parameter (the message number parameter). Example:  Output:  The logging level can be automated by identifying a MessageLogLevel of type MessageLogLevelInterface. Example:  Output:  -- Logging errors -------------------------------------------------------------  Go errors can also be logged. Example:  Output:  -- Formatting -----------------------------------------------------------------  The format of the log message can be modified by choosing a different message format. Example:  Output:  go-logging/main.go implements examples.
Keywords: t-comm