-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go.old
75 lines (62 loc) · 2.22 KB
/
main.go.old
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package main
import (
"github.com/hellower/orascope_golib/anotherlib"
"github.com/hellower/orascope_golib/orascopeLogger"
"os"
"time"
// "github.com/pkg/errors"
)
var Glog *orascopeLogger.ClsLogger // global 변수임
func init() {
Glog = orascopeLogger.Glog()
Glog.TracingMode(true)
Glog.Trace("main.init") // 디폴트 콘솔임.
}
func main() {
Glog.Trace("main()")
Glog.Trace("%v", time.Now())
Glog.Info("version=%s", Glog.Version)
// 아래 안하면 디폴트로 콘솔로 출력!!!
//Glog.StartFile("r:\\", "abc.log") // StartFile 전까지 모두 콘솔
var err error
//Glog.FatalNew("start fatal...") // 자체 에러 생산
//-----------------------------------------------------------------------------------------
if _, err = os.OpenFile("r:\\X.X", os.O_CREATE|os.O_WRONLY, 0644); err != nil {
Glog.Fatal(err)
Glog.Fatalf(err, "화일 오픈에러#3")
Glog.Fatalf(err, "화일 오픈에러#3=>%s", "x:\\x.x")
// Glog.Fatal(errors.New("file open error"))
// Glog.Fatal(errors.Wrap(err, "화일 오픈에러#3"))
// Glog.Fatal(errors.Wrapf(err, "화일 오픈에러#3=>%s", "x:\\x.x"))
}
//-----------------------------------------------------------------------------------------
an := new(another.Another)
if err = an.ErrTest(); err != nil {
Glog.Fatal(err)
}
if err = an.ErrTest2(); err != nil {
Glog.Fatal(err)
}
an.InfoTest()
// an.InfoTest2()
//an.FatalTest()
//-----------------------------------------------------------------------------------------
_, err = os.OpenFile("z:/a.txt", os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
Glog.Trace("%+v", "화일오픈에러#1")
Glog.Trace("%+v, %s", err, "화일에러#2")
Glog.Trace("%+v 화일에러#2=>%s", err, "z:/a.txt")
// Glog.Trace("%+v", errors.New("화일오픈에러#1"))
// Glog.Trace("%+v", errors.Wrap(err, "화일에러#2"))
// Glog.Trace("%+v", errors.Wrapf(err, "화일에러#2=>%s", "z:/a.txt"))
//os.Exit(1)
// main 함수가 끝나기 직전에 파일을 닫음
} // end if
//-----------------------------------------------------------------------------------------
Glog.Info("%d##%s", 123, "batman")
Glog.Trace("%d##%s", 123, "batman")
//Glog.Info("superman")
defer func() {
Glog.CleanUp()
}()
}