Skip to content

Commit 4cba492

Browse files
committed
example test
1 parent 5ad4a37 commit 4cba492

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

example_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package timberjack
2+
3+
import (
4+
"log"
5+
"time"
6+
)
7+
8+
// To use timberjack with the standard library's log package, just pass it into
9+
// the SetOutput function when your application starts.
10+
func Example() {
11+
log.SetOutput(&Logger{
12+
Filename: "/var/log/myapp/foo.log",
13+
MaxSize: 500, // megabytes
14+
MaxBackups: 3, // number of backups
15+
MaxAge: 28, // days
16+
Compress: true, // disabled by default
17+
LocalTime: true, // use the local timezone
18+
RotationInterval: time.Hour * 24, // rotate daily
19+
})
20+
}

0 commit comments

Comments
 (0)