File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,28 @@ func init() {
2727// Another possibility is to add the following strings between the level and the message:
2828// file={name},line={line},endLine={endLine},title={title}
2929func SetGithubOutput () zerolog.Logger {
30- // the following formatlevel func might need to rename levels to match with github naming
30+ // the following formatlevel loosely translates from posix levels to github levels
3131 consoleOutput .FormatLevel = func (i interface {}) string {
32- return fmt .Sprintf ("::%s" , i )
32+ var l string
33+ if ll , ok := i .(string ); ok {
34+ switch ll {
35+ case zerolog .LevelTraceValue , zerolog .LevelDebugValue :
36+ l = "debug"
37+ case zerolog .LevelInfoValue :
38+ l = "notice "
39+ case zerolog .LevelWarnValue :
40+ l = "warn "
41+ case zerolog .LevelErrorValue , zerolog .LevelFatalValue , zerolog .LevelPanicValue :
42+ l = "error "
43+ default :
44+ l = "???"
45+ }
46+ } else {
47+ if i == nil {
48+ l = "???"
49+ }
50+ }
51+ return fmt .Sprintf ("::%s" , l )
3352 }
3453 consoleOutput .FormatMessage = func (i interface {}) string {
3554 return fmt .Sprintf ("::%s" , i )
You can’t perform that action at this time.
0 commit comments