-
Notifications
You must be signed in to change notification settings - Fork 10
/
doc.go
76 lines (57 loc) · 1.83 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
Package coralogix provides SDK for sending logs to Coralogix.
The simple example:
package main
import (
coralogix "github.com/coralogix/go-coralogix-sdk"
)
func main() {
coralogix.SetDebug(true)
logger := coralogix.NewCoralogixLogger(
"YOUR_PRIVATE_KEY_HERE",
"YOUR_APPLICATION_NAME",
"YOUR_SUBSYSTEM_NAME",
)
defer logger.Destroy()
logger.Debug("Test message 1")
logger.Info(map[string]string{
"text": "Test message 2",
"extra": "additional",
})
logger.Warning("Test message 4")
}
If you want to use Coralogix SDK with Logrus logging library:
package main
import (
coralogix "github.com/coralogix/go-coralogix-sdk"
"github.com/sirupsen/logrus"
)
func main() {
CoralogixHook := coralogix.NewCoralogixHook(
"YOUR_PRIVATE_KEY_HERE",
"YOUR_APPLICATION_NAME",
"YOUR_SUBSYSTEM_NAME",
)
defer CoralogixHook.Close()
log := logrus.New()
log.SetLevel(logrus.DebugLevel)
log.AddHook(CoralogixHook)
log.Info("Test message!")
log.WithFields(logrus.Fields{
"Category": "MyCategory",
"ClassName": "MyClassName",
"MethodName": "MyMethodName",
"ThreadId": "MyThreadId",
}).Info("Test message 2!")
log.WithFields(logrus.Fields{
"extra": "additional",
}).Info("Test message 3!")
log.Debug("Test message 4!")
log.Fatal("Test message 5!")
}
For a source watch https://github.com/coralogix/go-coralogix-sdk
Copyright 2021 Coralogix Ltd. All rights reserved.
Use of this source code is governed by a Apache 2.0
license that can be found in the LICENSE file.
*/
package coralogix