Skip to content

Bad JSON for messages with newlines or quotes #11

Closed
@sam701

Description

@sam701

gommon.log produces erroneous JSON output if the passed message contains newline characters or quotes.

	e.Logger.Info(`hello 
	"world"`)

produces

{"time":"2016-12-18T14:51:44+01:00","level":"INFO","prefix":"echo","file":"main.go","line":"28","message":"hello
	"world""}

This means all panics caught and logged by Echo as JSON are not parsable.

func someHandler(c echo.Context) error {
	panic("abcde")
	return c.String(http.StatusOK, "Hello, World!")
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions