You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use Zerolog for logging some JSON strings with RawJSON function. Sometimes that JSON can be very large. The problem is that logging system has certain limitation for length of the log's line and I can't control that. Max length is about 16KB. I really need to log at least part of that JSON (with some other metadata) so I've tried to trim it to 16KB and use Bytes function.
The problem here is that Bytes function escapes some special characters (double quotes etc). As result that string becomes bigger and exceeds my limit of 16KB.
I've tried to lower LogSizeLimit to let's say 15KB. It helps but not for all cases. There should be more elegant solution.
Also I thought about escaping that trimmed JSON string myself and counting how may new symbols added. Than I can trim that string even more. But that solution sounds somehow complicated and bug-prone.
Maybe I can disable escaping in Zerolog? Or should I strictly limit my log's line size to half of the logging system's limit: 16KB / 2 = 7.5KB? Maybe I could limit log's size on Zerolog's side?
The text was updated successfully, but these errors were encountered:
I use Zerolog for logging some JSON strings with RawJSON function. Sometimes that JSON can be very large. The problem is that logging system has certain limitation for length of the log's line and I can't control that. Max length is about 16KB. I really need to log at least part of that JSON (with some other metadata) so I've tried to trim it to 16KB and use Bytes function.
var LogSizeLimit = 15000
The problem here is that Bytes function escapes some special characters (double quotes etc). As result that string becomes bigger and exceeds my limit of 16KB.
I've tried to lower LogSizeLimit to let's say 15KB. It helps but not for all cases. There should be more elegant solution.
Also I thought about escaping that trimmed JSON string myself and counting how may new symbols added. Than I can trim that string even more. But that solution sounds somehow complicated and bug-prone.
Maybe I can disable escaping in Zerolog? Or should I strictly limit my log's line size to half of the logging system's limit: 16KB / 2 = 7.5KB? Maybe I could limit log's size on Zerolog's side?
The text was updated successfully, but these errors were encountered: