-
Notifications
You must be signed in to change notification settings - Fork 604
Open
Description
Hi,
I am integrating zerolog with GCP logging. The Entry
type only supports a string or an interface that can be marshalled by encoding/json
.
However, in the WriteLevel
method, I only get an array of bytes. Is that the serialised content of the log object? Is there a way to deserialise it back into an object and also make sure this object is compatible with encoding/json
?
If I pass that array to the GCP logger's Payload field directly, it is treated as string
and the log looks like this in the GCP console:
The log from zerolog becomes a string and is saved in the textPayload
field.
{
"textPayload": "{\"level\":\"info\",\"message\":\"content error\n\"}",
"insertId": "====",
"resource": {
"type": "project",
"labels": {
"project_id": "===="
}
},
"timestamp": "2025-08-15T01:52:38.638116838Z",
"severity": "INFO",
"logName": "projects/d===",
"receiveTimestamp": "2025-08-15T01:52:38.894528999Z"
}
Thanks
Metadata
Metadata
Assignees
Labels
No labels