-
Notifications
You must be signed in to change notification settings - Fork 1
/
doc.go
54 lines (54 loc) · 1.51 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Package log is the Simple Logging Facade for Go provides an easy access who
// everyone who wants to log something and do not want to care how it is logged
// and gives others the possibility to implement their own loggers in easy way.
//
// # Usage
//
// There are 2 common ways to use this framework.
//
// 1. By getting a logger for your current package. This is the most common way
// and is quite clean for one package. If the package contains too many logic
// it might worth it to use the 2nd approach (see below).
//
// package foo
//
// import "github.com/echocat/slf4g"
//
// var logger = log.GetLoggerForCurrentPackage()
//
// func sayHello() {
// // will log with logger="github.com/user/foo"
// logger.Info("Hello, world!")
// }
//
// 2. By getting a logger for the object the logger is for. This is the most
// clean approach and will give you later the maximum flexibility and control.
//
// package foo
//
// import "github.com/echocat/slf4g"
//
// var logger = log.GetLogger(myType{})
//
// type myType struct {
// ...
// }
//
// func (mt myType) sayHello() {
// // will log with logger="github.com/user/foo.myType"
// logger.Info("Hello, world!")
// }
//
// 3. By using the global packages methods which is quite equal to how the SDK
// base logger works. This is only recommend for small application and not for
// libraries you like to export.
//
// package foo
//
// import "github.com/echocat/slf4g"
//
// func sayHello() {
// // will log with logger=ROOT
// log.Info("Hello, world!")
// }
package log