~ubuntu-branches/ubuntu/trusty/juju-core/trusty-proposed

« back to all changes in this revision

Viewing changes to src/github.com/loggo/loggo/README.md

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-03 09:22:46 UTC
  • mfrom: (1.1.17)
  • Revision ID: package-import@ubuntu.com-20140203092246-e03vg402vztzo4qa
Tags: 1.17.2-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
loggo - hierarchical loggers for Go
 
2
===================================
 
3
 
 
4
This package provides an alternative to the standard library log package.
 
5
 
 
6
The actual logging functions never return errors.  If you are logging
 
7
something, you really don't want to be worried about the logging
 
8
having trouble.
 
9
 
 
10
Modules have names that are defined by dotted strings.
 
11
```
 
12
"first.second.third"
 
13
```
 
14
 
 
15
There is a root module that has the name `""`.  Each module
 
16
(except the root module) has a parent, identified by the part of
 
17
the name without the last dotted value.
 
18
* the parent of `"first.second.third"` is `"first.second"`
 
19
* the parent of `"first.second"` is `"first"`
 
20
* the parent of `"first"` is `""` (the root module)
 
21
 
 
22
Each module can specify its own severity level.  Logging calls that are of
 
23
a lower severity than the module's effective severity level are not written
 
24
out.
 
25
 
 
26
Loggers are created using the GetLogger function.
 
27
```
 
28
logger := loggo.GetLogger("foo.bar")
 
29
```
 
30
 
 
31
By default there is one writer registered, which will write to Stderr,
 
32
and the root module, which will only emit warnings and above.
 
33
 
 
34
Use the usual `Sprintf` syntax for:
 
35
```
 
36
logger.Criticalf(...)
 
37
logger.Errorf(...)
 
38
logger.Warningf(...)
 
39
logger.Infof(...)
 
40
logger.Debugf(...)
 
41
logger.Tracef(...)
 
42
```
 
43
 
 
44
If in doubt, look at the tests. They are quite good at observing the expected behaviour.
 
45
 
 
46
The loggers themselves are go-routine safe.  The locking is on the output to the writers, and transparent to the caller.