proxy.golang.org : github.com/rightscale/rlog
Package rlog is an advanced and extensible logger for Go. Package rlog implements the core logging facility, which are the user API and log message processing. The rlog output modules are producing the output, i.e. without any enabled modules, rlog does not produce any output. Note that all methods provided by rlog are thread safe. Configuring rlog & enabling modules Output modules offer a "new" method to create a new instance for that particular output type and rlog offers the EnableModule method to enable each method satisfying the required interface provided by the rlog. rlog is configured by retrieving and modifying the default configuration using the GetDefaultConfig() method. Once started, rlog's configuration cannot be modified. rlog is usually initialized in main. When calling "rlog.Start()", it is advisable to call "defer rlog.Flush() right after to ensure that upon termination of the main method, all log entries are written. Example setup procedure with stdout and syslog output: Example: setup using tags rlog exists as a singleton and output can be produced by simply importing the rlog package and calling the various print messages on it. Output methods ending with a T (e.g. infoT) require a tag argument. Tags are user defined strings. It is highly recommended to define tags as constants to avoid typos. Tags are currently NOT implemented. Example: GenerateID() generates a unique, hex formatted string ID. The initial value is random and each successive call increments it. Log objects are can be retrieved using the NewLogger method. The user gets back an object referring to the singleton logger, offering the same API as the rlog package. This allows to mock rlog package using an interface requirement when generating shared libraries.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/rightscale/rlog
License: MIT
Latest release: almost 11 years ago
First release: about 11 years ago
Namespace: github.com/rightscale
Last synced: 3 days ago