Merge pull request #197 from dagger/logger-json

logger: serialize unknown fields to json
This commit is contained in:
Andrea Luzzardi 2021-03-18 11:50:44 -07:00 committed by GitHub
commit 1309af9c9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,6 +163,12 @@ func (c *Console) formatFields(entry map[string]interface{}) string {
fields = append(fields, fmt.Sprintf("%s=%s", key, s)) fields = append(fields, fmt.Sprintf("%s=%s", key, s))
case nil: case nil:
fields = append(fields, fmt.Sprintf("%s=null", key)) fields = append(fields, fmt.Sprintf("%s=null", key))
default:
o, err := json.MarshalIndent(v, "", " ")
if err != nil {
panic(err)
}
fields = append(fields, fmt.Sprintf("%s=%s", key, o))
} }
} }