-
Notifications
You must be signed in to change notification settings - Fork 31
/
defaultWriter_test.go
60 lines (53 loc) · 1.31 KB
/
defaultWriter_test.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
55
56
57
58
59
60
// Copyright (c) 2023, huangjunwei <huangjunwei@youmi.net>. All rights reserved.
package blog4go
import (
"testing"
)
func TestDefaultWriterBasicOperation(t *testing.T) {
blog = &DefaultWriter{}
defer blog.Close()
// test basic operations
blog.SetTags(map[string]string{"tagName": "tagValue"})
blog.Tags()
blog.Debug("Debug", 1)
blog.Debugf("%s", "Debug")
blog.Trace("Trace", 2)
blog.Tracef("%s", "Trace")
blog.Info("Info", 3)
blog.Infof("%s", "Info")
blog.Warn("Warn", 4)
blog.Warnf("%s", "Warn")
blog.Error("Error", 5)
blog.Errorf("%s", "Error")
blog.Critical("Critical", 6)
blog.Criticalf("%s", "Critical")
blog.flush()
blog.SetHookAsync(true)
blog.Colored()
blog.SetColored(true)
blog.TimeRotated()
blog.SetTimeRotated(true)
blog.Level()
blog.SetLevel(CRITICAL)
blog.Retentions()
blog.SetRetentions(0)
blog.SetRetentions(7)
blog.RotateLines()
blog.SetRotateLines(0)
blog.SetRotateLines(100000)
blog.RotateSize()
blog.SetRotateSize(0)
blog.SetRotateSize(1024 * 1024 * 500)
blog.Debug("Debug", 1)
blog.Debugf("%s\\", "Debug")
blog.Trace("Trace", 2)
blog.Tracef("%s", "Trace")
blog.Info("Info", 3)
blog.Infof("%s", "Info")
blog.Warn("Warn", 4)
blog.Warnf("%s", "Warn")
blog.Error("Error", 5)
blog.Errorf("%s", "Error")
blog.Critical("Critical", 6)
blog.Criticalf("%s", "Critical")
}