Skip to content

Commit

Permalink
Add docs for level.go.
Browse files Browse the repository at this point in the history
  • Loading branch information
nfranzeck committed May 22, 2024
1 parent c556bd3 commit b23dbf2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/logging/level.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"
)

// LogLevel is the log level that can be defined for a dogu.
type LogLevel int

const (
Expand All @@ -17,6 +18,7 @@ const (
LevelDebug
)

// String converts LogLevel type to a string
func (l LogLevel) String() string {
switch l {
case LevelUnknown:
Expand All @@ -34,6 +36,7 @@ func (l LogLevel) String() string {
}
}

// CreateLogLevelFromProto maps protobuf log level to an internal log level used in application
func CreateLogLevelFromProto(pLevel pb.LogLevel) (LogLevel, error) {
switch pLevel {
case pb.LogLevel_DEBUG:
Expand All @@ -49,6 +52,7 @@ func CreateLogLevelFromProto(pLevel pb.LogLevel) (LogLevel, error) {
}
}

// CreateLogLevelFromString maps a string to an internal log level used in application
func CreateLogLevelFromString(sLevel string) (LogLevel, error) {
sLevelUpper := strings.ToUpper(sLevel)

Expand Down

0 comments on commit b23dbf2

Please sign in to comment.