Skip to content

Logging

Crow comes with a simple and easy to use logging system.

Setting up logging level

You can set up the level at which crow displays logs by using the app's loglevel(crow::LogLevel) method.

The available log levels are as follows (please not that setting a level will also display all logs below this level):

  • Debug
  • Info
  • Warning
  • Error
  • Critical

To set a logLevel, just use app.loglevel(crow::LogLevel::Warning), This will not show any debug or info logs. It will however still show error and critical logs.

Please note that setting the Macro CROW_ENABLE_DEBUG during compilation will also set the log level to Debug.

Writing a log

Writing a log is as simple as CROW_LOG_<LOG LEVEL> << "Hello"; (replace<LOG LEVEL> with the actual level in all caps, so you have CROW_LOG_WARNING).