ePrivacy and GPDR Cookie Consent by Cookie Consent


hermes is used for creating diagnostic messages at runtime. Amongst other things it is useful for debugging purposes and to diagnose errors in shipped software.

Starting the log

Logging is enabled by getting a reference to the log manager (a singleton), setting a log level for the messages and by adding a logger (file logger, console logger, custom logger).

Now simply start the log manager and it will launch a new thread. The logging thread logs to the specified locations including: the console, to file, syslog, etc...

Call run() to begin.

Stopping the log

When the logger is done being used, call the halt() method. This is not enough to stop the logger though. After halt(), the user has to call join() on the logger to finally join the logging thread.

hermes provides the convenience method halt_and_join() for stopping and joining the logger in a single step.

The two step stopping procedure is useful if you have other threads that need to be stopped. Thus you can first trigger to stop all threads and then join them. This will reduce shut down time.

Custom loggers

You can write custom loggers to log to new target locations (syslog, Windows event log, ...) or to forward the hermes log messages to your own logging system. To do this implement the logger interface.


There are two macros available for using the logger: SX_LOG and SX_LOG_HEX.

SX_LOG is for text messages with placeholder replacement. It generates one line in the log.

SX_LOG_HEX is a logging macro that can log hex editor style. It's useful to display binary data.


An example is available on the hello_yasmine project page.

Log levels






Used to turn logging off. This value is set as default when the log manager is created.



Error in internal logic that we cannot recover from. In DEBUG mode assert is called next, In RELEASE mode a program crash can be expected next.



Internal error which makes it impossible for the process to continue working. The program state is valid though and thus the program can continue running.



An error occurred.



An unusual condition occurred that could be an error (e.g. a timed event could not be cancelled, this could be a logic error or the event might have just fired).



Important information for the user about the process.



Information for the user about the proces.



Information about internal processes.



Detailed information about internal processes.

A smaller index implies a higher priority.

Disabling logging

In order to completely disable logging, compile the library with SX_NO_LOGGING defined. Then the log macros expands to nothing and thus no code is generated and no run-time overhead occurs. This is useful if you don't want any logging overhead in your code, but you don't want to remove your logging code either. Also you could activate logging for debug builds and deactivate it for release builds like this.