forked from SierraSoftworks/sentry-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseverity.go
49 lines (37 loc) · 1.21 KB
/
severity.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
package sentry
import "encoding/json"
func init() {
// Configure the default severity level as Error
AddDefaultOptions(Level(Error))
}
// Level is used to set the severity level of an event before it
// is sent to Sentry
func Level(severity Severity) Option {
return &levelOption{severity}
}
type levelOption struct {
severity Severity
}
func (o *levelOption) Class() string {
return "level"
}
func (o *levelOption) MarshalJSON() ([]byte, error) {
return json.Marshal(o.severity)
}
// Severity represents a Sentry event severity (ranging from debug to fatal)
type Severity string
const (
// Fatal represents exceptions which result in the application exiting fatally
Fatal = Severity("fatal")
// Error represents exceptions which break the expected application flow
Error = Severity("error")
// Warning represents events which are abnormal but do not prevent the application
// from operating correctly
Warning = Severity("warning")
// Info is used to expose information about events which occur during normal
// operation of the application
Info = Severity("info")
// Debug is used to expose verbose information about events which occur during
// normal operation of the application
Debug = Severity("debug")
)