David K. Bainbridge | 528b318 | 2017-01-23 08:51:59 -0800 | [diff] [blame] | 1 | // Copyright 2014 Canonical Ltd. |
| 2 | // Licensed under the LGPLv3, see LICENCE file for details. |
| 3 | |
| 4 | /* |
| 5 | [godoc-link-here] |
| 6 | |
| 7 | Module level logging for Go |
| 8 | |
| 9 | This package provides an alternative to the standard library log package. |
| 10 | |
| 11 | The actual logging functions never return errors. If you are logging |
| 12 | something, you really don't want to be worried about the logging |
| 13 | having trouble. |
| 14 | |
| 15 | Modules have names that are defined by dotted strings. |
| 16 | "first.second.third" |
| 17 | |
| 18 | There is a root module that has the name `""`. Each module |
| 19 | (except the root module) has a parent, identified by the part of |
| 20 | the name without the last dotted value. |
| 21 | * the parent of "first.second.third" is "first.second" |
| 22 | * the parent of "first.second" is "first" |
| 23 | * the parent of "first" is "" (the root module) |
| 24 | |
| 25 | Each module can specify its own severity level. Logging calls that are of |
| 26 | a lower severity than the module's effective severity level are not written |
| 27 | out. |
| 28 | |
| 29 | Loggers are created using the GetLogger function. |
| 30 | logger := loggo.GetLogger("foo.bar") |
| 31 | |
| 32 | By default there is one writer registered, which will write to Stderr, |
| 33 | and the root module, which will only emit warnings and above. |
| 34 | If you want to continue using the default |
| 35 | logger, but have it emit all logging levels you need to do the following. |
| 36 | |
| 37 | writer, _, err := loggo.RemoveWriter("default") |
| 38 | // err is non-nil if and only if the name isn't found. |
| 39 | loggo.RegisterWriter("default", writer, loggo.TRACE) |
| 40 | |
| 41 | */ |
| 42 | package loggo |