jp-embedded / scxmlcc

The SCXML state machine to C++ compiler
GNU General Public License v3.0
140 stars 34 forks source link

Feature: user-defined log function #99

Closed sstiller closed 5 years ago

sstiller commented 5 years ago

What do you think about a logging function, defined by the user? In my case the logs of the state machine do not fit into the logging concept. The logs shall be sent to stderr or to a logging server depending on the current log level. Before I add something, I'd like to know what other people think about it.

jp-embedded commented 5 years ago

Well, you can relatively easy redirect clog. Example: https://github.com/jp-embedded/cpp-syslog Would somthing like that be helpful?

ringlej commented 5 years ago

Yup. What @jp-embedded shows in his cpp-syslog is exactly the technique I use. Here is an example of one that I've used to log the time delta since the previous log message emitted by the same thread: https://gist.github.com/ringlej/f17ae5507d96a186c26e9113ee16f12b

sstiller commented 5 years ago

I never thought about that, looks great. Thank you!