Matthias Andreas Benkard | 832a54e | 2019-01-29 09:27:38 +0100 | [diff] [blame^] | 1 | glog |
| 2 | ==== |
| 3 | |
| 4 | Leveled execution logs for Go. |
| 5 | |
| 6 | This is an efficient pure Go implementation of leveled logs in the |
| 7 | manner of the open source C++ package |
| 8 | https://github.com/google/glog |
| 9 | |
| 10 | By binding methods to booleans it is possible to use the log package |
| 11 | without paying the expense of evaluating the arguments to the log. |
| 12 | Through the -vmodule flag, the package also provides fine-grained |
| 13 | control over logging at the file level. |
| 14 | |
| 15 | The comment from glog.go introduces the ideas: |
| 16 | |
| 17 | Package glog implements logging analogous to the Google-internal |
| 18 | C++ INFO/ERROR/V setup. It provides functions Info, Warning, |
| 19 | Error, Fatal, plus formatting variants such as Infof. It |
| 20 | also provides V-style logging controlled by the -v and |
| 21 | -vmodule=file=2 flags. |
| 22 | |
| 23 | Basic examples: |
| 24 | |
| 25 | glog.Info("Prepare to repel boarders") |
| 26 | |
| 27 | glog.Fatalf("Initialization failed: %s", err) |
| 28 | |
| 29 | See the documentation for the V function for an explanation |
| 30 | of these examples: |
| 31 | |
| 32 | if glog.V(2) { |
| 33 | glog.Info("Starting transaction...") |
| 34 | } |
| 35 | |
| 36 | glog.V(2).Infoln("Processed", nItems, "elements") |
| 37 | |
| 38 | |
| 39 | The repository contains an open source version of the log package |
| 40 | used inside Google. The master copy of the source lives inside |
| 41 | Google, not here. The code in this repo is for export only and is not itself |
| 42 | under development. Feature requests will be ignored. |
| 43 | |
| 44 | Send bug reports to golang-nuts@googlegroups.com. |