blob: bb19cd5749052eb36c7804f34814b06f62475aee [file] [log] [blame]
David K. Bainbridge528b3182017-01-23 08:51:59 -08001// Copyright 2014 Canonical Ltd.
2// Licensed under the LGPLv3, see LICENCE file for details.
3
4/*
5[godoc-link-here]
6
7Module level logging for Go
8
9This package provides an alternative to the standard library log package.
10
11The actual logging functions never return errors. If you are logging
12something, you really don't want to be worried about the logging
13having trouble.
14
15Modules have names that are defined by dotted strings.
16 "first.second.third"
17
18There is a root module that has the name `""`. Each module
19(except the root module) has a parent, identified by the part of
20the 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
25Each module can specify its own severity level. Logging calls that are of
26a lower severity than the module's effective severity level are not written
27out.
28
29Loggers are created using the GetLogger function.
30 logger := loggo.GetLogger("foo.bar")
31
32By default there is one writer registered, which will write to Stderr,
33and the root module, which will only emit warnings and above.
34If you want to continue using the default
35logger, 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*/
42package loggo