Debian Codegraph @

doc.go

raw symbols SCIP
1 // Copyright (c) 2012-2016 Eli Janssen
2 // Use of this source code is governed by an MIT-style
3 // license that can be found in the LICENSE file.
4
5 /*
6 Package mlog provides a purposefully basic logging library for Go.
7
8 mlog only has 3 logging levels: debug, info, and fatal.
9
10 Each logging level has 3 logging methods. As an example, the following methods
11 log at the "info" level: Info, Infof, Infom. There are similar methods for
12 the fatal and debug levels.
13
14 Example usage:
15
16 import (
17 "bytes"
18
19 "github.com/cactus/mlog"
20 )
21
22 func main() {
23 mlog.Infom("this is a log", mlog.Map{
24 "interesting": "data",
25 "something": 42,
26 })
27
28 mlog.Debugm("this won't print")
29
30 // set flags for the default logger
31 // alternatively, you can create your own logger
32 // and supply flags at creation time
33 mlog.SetFlags(mlog.Ldebug)
34
35 mlog.Debugm("this will print!")
36
37 mlog.Debugm("can it print?", mlog.Map{
38 "how_fancy": []byte{'v', 'e', 'r', 'y', '!'},
39 "this_too": bytes.NewBuffer([]byte("if fmt.Print can print it!")),
40 })
41
42 // you can use a more classical Printf type log method too.
43 mlog.Debugf("a printf style debug log: %s", "here!")
44 mlog.Infof("a printf style info log: %s", "here!")
45
46 mlog.Fatalm("time for a nap", mlog.Map{"cleanup": false})
47 }
48 */
49 package mlog