Rumba C++ SDK
Logger.h
Go to the documentation of this file.
1 /*
2 
3  *
4  ***
5  *****
6  ********************* Mercenaries Engineering SARL
7  ***************** Copyright (C) 2018
8  *************
9  ********* http://www.mercenaries-engineering.com
10  ***********
11  **** ****
12  ** **
13 
14 */
15 #pragma once
16 # include <spdlog/logger.h>
17 # include <spdlog/fmt/ostr.h>
18 # include "Export.h"
19  namespace maquina
20  {
22  MAQUINA_EXPORT spdlog::logger& logger();
23 
25  template< typename... Args >
26  void debug( const char *format, const Args &... args )
27  {
28  logger().debug( format, args ... );
29  }
30 
32  template< typename... Args >
33  void info( const char *format, const Args &... args )
34  {
35  logger().info( format, args ... );
36  }
37 
39  template< typename... Args >
40  void warn( const char *format, const Args &... args )
41  {
42  logger().warn( format, args ... );
43  }
44 
45  using verbosity_level = spdlog::level::level_enum;
46 
48 
49  template< typename... Args >
50  void error( const char *format, const Args &... args )
51  {
52  logger().error( format, args ... );
53  }
54 
56 
57  template< typename... Args >
58  void critical( const char *filename, int line, const char *function, const char *format, const Args &... args )
59  {
60  logger().log( spdlog::source_loc{ filename, line, function }, verbosity_level::critical, format, args... );
61  }
62  }
63 
64 # define RUMBA_LOG_CRITICAL( ... ) ::maquina::critical( __FILE__, __LINE__, SPDLOG_FUNCTION, __VA_ARGS__ )
void info(const char *format, const Args &... args)
Log an informative message using the Rumba logger.
Definition: Logger.h:33
void error(const char *format, const Args &... args)
Log an error message using the Rumba logger.
Definition: Logger.h:50
void debug(const char *format, const Args &... args)
Log a debug message using the Rumba logger.
Definition: Logger.h:26
void critical(const char *filename, int line, const char *function, const char *format, const Args &... args)
Log a critical error message using the Rumba logger.
Definition: Logger.h:58
This version of the SDK is unstable, i-e, it may change with no warning.
Definition: AddCurveAction.h:20
#define MAQUINA_EXPORT
Definition: Export.h:31
void warn(const char *format, const Args &... args)
Log a warning message using the Rumba logger.
Definition: Logger.h:40
spdlog::level::level_enum verbosity_level
Definition: Logger.h:45