quill icon indicating copy to clipboard operation
quill copied to clipboard

How to log binary data

Open jamespinkerton opened this issue 2 years ago • 1 comments

Hi. I have a struct that contains only numbers (float's, uint32_t's, bool's, things like this).

I'd like to be able to log a sequence of these structs to a file with Quill. I'm using Quill extensively to log messages of strings and it's working very well. But I haven't been able to figure out how to use it to log raw data.

I'm sorry if this is actually obvious. Any help would be greatly appreciated!

James

jamespinkerton avatar Jan 02 '24 15:01 jamespinkerton

Why not format it as json? then you can recover the struct easily from the log.

qiuwei avatar Feb 02 '24 01:02 qiuwei

hey sorry for the late response. It is not possible to log binary raw data, the backend thread will always try to format messages to human readable string before writing them to the log file. You format them on the hot path to hex (https://github.com/odygrd/quill/blob/master/quill/include/quill/Utility.h#L28) and then print them to the log file, that is more useful for debugging purposes

odygrd avatar Mar 14 '24 09:03 odygrd