02a03cec by astaxie

add logs readme

1 parent 31fbd524
1 ## logs
2 logs is a Go logs manager. It can use many logs adapters. The repo is inspired by `database/sql` .
3
4
5 ## How to install?
6
7 go get github.com/astaxie/beego/logs
8
9
10 ## What adapters are supported?
11
12 As of now this logs support console, file,smtp and conn.
13
14
15 ## How to use it?
16
17 First you must import it
18
19 import (
20 "github.com/astaxie/beego/logs"
21 )
22
23 Then init a Log (example with console adapter)
24
25 log := NewLogger(10000)
26 log.SetLogger("console", "")
27
28 > the first params stand for how many channel
29
30 Use it like this:
31
32 log.Trace("trace")
33 log.Info("info")
34 log.Warn("warning")
35 log.Debug("debug")
36 log.Critical("critical")
37
38
39 ## File adapter
40
41 Configure file adapter like this:
42
43 log := NewLogger(10000)
44 log.SetLogger("file", `{"filename":"test.log"}`)
45
46
47 ## Conn adapter
48
49 Configure like this:
50
51 log := NewLogger(1000)
52 log.SetLogger("conn", `{"net":"tcp","addr":":7020"}`)
53 log.Info("info")
54
55
56 ## Smtp adapter
57
58 Configure like this:
59
60 log := NewLogger(10000)
61 log.SetLogger("smtp", `{"username":"beegotest@gmail.com","password":"xxxxxxxx","host":"smtp.gmail.com:587","sendTos":["xiemengjun@gmail.com"]}`)
62 log.Critical("sendmail critical")
63 time.Sleep(time.Second * 30)
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!