NVIDIA Iray: Base API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ilogger.h
Go to the documentation of this file.
1 //*****************************************************************************
2 // Copyright 1986, 2014 NVIDIA Corporation. All rights reserved.
3 //*****************************************************************************
8 //*****************************************************************************
9 
10 #ifndef MI_BASE_ILOGGER_H
11 #define MI_BASE_ILOGGER_H
12 
13 #include <cstdarg>
14 #include <cstdio>
15 
16 #include <mi/base/config.h>
17 #include <mi/base/enums.h>
18 #include <mi/base/iinterface.h>
20 
21 namespace mi {
22 
23 namespace base {
24 
37 class ILogger : public
65  Interface_declare<0x4afbf19a,0x5fb7,0x4422,0xae,0x4b,0x25,0x13,0x06,0x2c,0x30,0x5f>
66 {
67 public:
85  virtual void message(
86  Message_severity level, const char* module_category, const char* message) = 0;
87 
107  inline void printf(
108  Message_severity level, const char* module_category, const char* message, ...)
109 #ifdef MI_COMPILER_GCC
110  __attribute__((format(printf, 4, 5)))
111 #endif
112  {
113  va_list args;
114  va_start( args, message);
115  char buffer[1024];
116  vsnprintf( &buffer[0], 1023, message, args);
117  this->message( level, module_category, &buffer[0]);
118  va_end( args);
119  }
120 };
121  // end group mi_base_ilogger
123 
124 } // namespace base
125 
126 } // namespace mi
127 
128 #endif // MI_BASE_ILOGGER_H