RafaGago / mini-async-log

Non bloated asynchronous logger
Other
220 stars 20 forks source link

logging individual characters (char) #15

Closed funkyshoc closed 7 years ago

funkyshoc commented 7 years ago

Hello the logger seems to log individual characters such as 'C' as the ASCII 67. I think there is quite a bit of value in logging them as is such as C

(for the native type char)

00000000000.019507570 [err_] message 37, char ('C') = 67

If there is no way to do so, do you think this would be easy to change?

RafaGago commented 7 years ago

An extra modifier is nedeed: https://github.com/RafaGago/mini-async-log/blob/master/src/mal_log/log_writer.hpp#L318

Then to update the compile time validators: https://github.com/RafaGago/mini-async-log/blob/master/include/mal_log/compile_format_validator.hpp#L92

And finally to update the runtime validator: https://github.com/RafaGago/mini-async-log/blob/master/src/mal_log/log_writer.hpp#L280

To workaround it I guess that you can waste two bytes and pass it as a variable length string:

char v = 0: bool success = log_error ("v = {}", deep (&v, 1)):

"deep" is an alias for "deep_copy"

I will try to add this modifier if I get some time. .

RafaGago commented 7 years ago

It turned out to be easy to fix:

https://github.com/RafaGago/mini-async-log/commit/8a5ef6a33352fc06ade42ed404f919821b1a4125

funkyshoc commented 7 years ago

Great!