mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-03-29 21:47:00 +02:00
Add SeverityUndefined to otel/log
(#5072)
* Add SeverityUndefined * Add changelog entry --------- Co-authored-by: Sam Xie <sam@samxie.me>
This commit is contained in:
parent
ca35244789
commit
42c1708ed5
@ -12,6 +12,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
|
||||
- Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4906)
|
||||
- Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracehttp`. (#4906)
|
||||
- Add `SeverityUndefined` `const` to `go.opentelemetry.io/otel/log`.
|
||||
This value represents an unset severity level. (#5072)
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -13,6 +13,9 @@ type Severity int
|
||||
|
||||
// Severity values defined by OpenTelemetry.
|
||||
const (
|
||||
// SeverityUndefined represents an unset Severity.
|
||||
SeverityUndefined Severity = 0 // UNDEFINED
|
||||
|
||||
// A fine-grained debugging log record. Typically disabled in default
|
||||
// configurations.
|
||||
SeverityTrace1 Severity = 1 // TRACE
|
||||
|
@ -8,6 +8,7 @@ func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[SeverityUndefined-0]
|
||||
_ = x[SeverityTrace1-1]
|
||||
_ = x[SeverityTrace2-2]
|
||||
_ = x[SeverityTrace3-3]
|
||||
@ -34,14 +35,13 @@ func _() {
|
||||
_ = x[SeverityFatal4-24]
|
||||
}
|
||||
|
||||
const _Severity_name = "TRACETRACE2TRACE3TRACE4DEBUGDEBUG2DEBUG3DEBUG4INFOINFO2INFO3INFO4WARNWARN2WARN3WARN4ERRORERROR2ERROR3ERROR4FATALFATAL2FATAL3FATAL4"
|
||||
const _Severity_name = "UNDEFINEDTRACETRACE2TRACE3TRACE4DEBUGDEBUG2DEBUG3DEBUG4INFOINFO2INFO3INFO4WARNWARN2WARN3WARN4ERRORERROR2ERROR3ERROR4FATALFATAL2FATAL3FATAL4"
|
||||
|
||||
var _Severity_index = [...]uint8{0, 5, 11, 17, 23, 28, 34, 40, 46, 50, 55, 60, 65, 69, 74, 79, 84, 89, 95, 101, 107, 112, 118, 124, 130}
|
||||
var _Severity_index = [...]uint8{0, 9, 14, 20, 26, 32, 37, 43, 49, 55, 59, 64, 69, 74, 78, 83, 88, 93, 98, 104, 110, 116, 121, 127, 133, 139}
|
||||
|
||||
func (i Severity) String() string {
|
||||
i -= 1
|
||||
if i < 0 || i >= Severity(len(_Severity_index)-1) {
|
||||
return "Severity(" + strconv.FormatInt(int64(i+1), 10) + ")"
|
||||
return "Severity(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _Severity_name[_Severity_index[i]:_Severity_index[i+1]]
|
||||
}
|
||||
|
@ -19,6 +19,12 @@ func TestSeverity(t *testing.T) {
|
||||
value int
|
||||
str string
|
||||
}{
|
||||
{
|
||||
name: "SeverityUndefined",
|
||||
severity: log.SeverityUndefined,
|
||||
value: 0,
|
||||
str: "UNDEFINED",
|
||||
},
|
||||
{
|
||||
name: "SeverityTrace",
|
||||
severity: log.SeverityTrace,
|
||||
|
Loading…
x
Reference in New Issue
Block a user