Skip to content

Commit

Permalink
Merge pull request #5 from open-runtimes/fix-logging
Browse files Browse the repository at this point in the history
Fix: logging errors and multiple logs
  • Loading branch information
TorstenDittmann authored Jul 9, 2024
2 parents 8d19eae + 0f2ae4a commit ea7da97
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,21 @@ func (l Log) String() string {
}

func (c *Context) Log(message interface{}) {
c.Logger.Write(message, LOGGER_TYPE_LOG, false)
switch v := message.(type) {
default:
c.Logger.Write(fmt.Sprintf("%#v", v)+"\n", LOGGER_TYPE_LOG, false)
case string:
c.Logger.Write(v+"\n", LOGGER_TYPE_LOG, false)
}
}

func (c *Context) Error(message interface{}) {
c.Logger.Write(message, LOGGER_TYPE_ERROR, false)
switch v := message.(type) {
default:
c.Logger.Write(fmt.Sprintf("%#v", v)+"\n", LOGGER_TYPE_ERROR, false)
case string:
c.Logger.Write(v+"\n", LOGGER_TYPE_ERROR, false)
}
}

type Request struct {
Expand Down

0 comments on commit ea7da97

Please sign in to comment.