MADARA  3.1.8
LogMacros.h File Reference
#include "MADARA_Logger_export.h"
#include "ace/Log_Msg.h"
Include dependency graph for LogMacros.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 madara
 Copyright (c) 2015 Carnegie Mellon University.
 
 madara::utility
 Provides utility functions and classes for common tasks and needs.
 

Macros

#define DLINFO   ACE_TEXT("(%P|%t) [%M] - %T - ")
 
#define MADARA_DEBUG(L, X)
 
#define MADARA_DISABLE_TRACE()   do {} while (0)
 
#define MADARA_ENABLE_TRACE()   do {} while (0)
 
#define MADARA_ERROR(L, X)
 
#define MADARA_ERROR_BREAK(L, X)   { MADARA_ERROR (L, X); break; }
 
#define MADARA_ERROR_RETURN(L, X, Y)
 
#define MADARA_LOG_DETAILED_TRACE   10
 
#define MADARA_LOG_EMERGENCY   0
 Used for errors that cause the fatal shutdown of any portion of the infrastructure. More...
 
#define MADARA_LOG_ERROR   3
 Used to log detailed error information at the point of failure. More...
 
#define MADARA_LOG_EVENT_TRACE   7
 Used to trace significant actions within major/minor events. More...
 
#define MADARA_LOG_MAJOR_DEBUG_INFO   8
 Used to display important configuration information that impacts major MADARA events. More...
 
#define MADARA_LOG_MAJOR_EVENT   5
 Used to indicate that a ``significant'' MADARA event has completed. More...
 
#define MADARA_LOG_MINOR_EVENT   6
 Used to inficate a ``minor'' MADARA event has completed. More...
 
#define MADARA_LOG_NONFATAL_ERROR   2
 Used for non-fatal deployment errors that do not cause deployment failure. More...
 
#define MADARA_LOG_TERMINAL_ERROR   1
 Used for MADARA errors at the point the error exits the process in question, or when a decision is made to cause the MADARA suite to fail. More...
 
#define MADARA_LOG_TRACE   9
 The following two statements are used to closely trace the execution of MADARA code. More...
 
#define MADARA_LOG_WARNING   4
 used to indicate that a questionable situation that doesn't cause deployment failure, but can cause undefined conditions. More...
 
#define MADARA_NTRACE   1
 
#define MADARA_TRACE(X)   do {} while (0)
 

Enumerations

enum  madara::utility::LogLevels {
  madara::utility::LOG_EMERGENCY = 0, madara::utility::LOG_TERMINAL_ERROR = 1, madara::utility::LOG_NONFATAL_ERROR = 2, madara::utility::LOG_ERROR = 3,
  madara::utility::LOG_WARNING = 4, madara::utility::LOG_MAJOR_EVENT = 5, madara::utility::LOG_MINOR_EVENT = 6, madara::utility::LOG_EVENT_TRACE = 7,
  madara::utility::LOG_MAJOR_DEBUG_INFO = 8, madara::utility::LOG_MINOR_DEBUG_INFO = 9, madara::utility::LOG_DETAILED_TRACE = 10
}
 Logging levels available for MADARA library. More...
 

Functions

int madara::utility::get_log_level (void)
 Gets the log level. More...
 
void madara::utility::log (int level, const char *message)
 Logs a simple string message. More...
 
void madara::utility::set_log_level (int level)
 Sets the log level. More...
 

Variables

ACE_Proper_Import_Flag int MADARA_debug_level
 

Detailed Description

Author
James Edmondson jedmo.nosp@m.ndso.nosp@m.n@gma.nosp@m.il.c.nosp@m.om

Macros used for logging in MADARA, based on the DAnCE Log Macros maintained by Will Otte wotte.nosp@m.@dre.nosp@m..vand.nosp@m.erbi.nosp@m.lt.ed.nosp@m.u.

Note that though we include MADARA_Logger_export for future expansion possibilities, we are simply including the LogMacros.h and LogMacros.cpp files into each project that might need these. Otherwise, KATS users would have to explicitly include Madara.dll or Madara.lib and Kats.dll or Kats.lib instead of just Kats.dll or Kats.lib.

Definition in file LogMacros.h.

Macro Definition Documentation

#define DLINFO   ACE_TEXT("(%P|%t) [%M] - %T - ")

Definition at line 27 of file LogMacros.h.

#define MADARA_DEBUG (   L,
 
)
Value:
do { \
if (MADARA_debug_level >= L) \
{ \
int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \
ace___->log X; \
} \
} while (0)
ACE_Proper_Import_Flag int MADARA_debug_level
Definition: LogMacros.cpp:5

Definition at line 137 of file LogMacros.h.

#define MADARA_DISABLE_TRACE ( )    do {} while (0)

Definition at line 76 of file LogMacros.h.

#define MADARA_ENABLE_TRACE ( )    do {} while (0)

Definition at line 75 of file LogMacros.h.

#define MADARA_ERROR (   L,
 
)
Value:
do { \
if (MADARA_debug_level >= L) \
{ \
int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
ace___->conditional_set (__FILE__, __LINE__, -1, __ace_error); \
ace___->log X; \
} \
} while (0)
ACE_Proper_Import_Flag int MADARA_debug_level
Definition: LogMacros.cpp:5

Definition at line 114 of file LogMacros.h.

#define MADARA_ERROR_BREAK (   L,
 
)    { MADARA_ERROR (L, X); break; }

Definition at line 175 of file LogMacros.h.

#define MADARA_ERROR_RETURN (   L,
  X,
 
)
Value:
do { \
if (MADARA_debug_level >= L) \
{ \
int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
ace___->conditional_set (__FILE__, __LINE__, Y, __ace_error); \
ace___->log X; \
return Y; \
} \
} while (0)
ACE_Proper_Import_Flag int MADARA_debug_level
Definition: LogMacros.cpp:5

Definition at line 162 of file LogMacros.h.

#define MADARA_LOG_DETAILED_TRACE   10

Definition at line 65 of file LogMacros.h.

#define MADARA_LOG_EMERGENCY   0

Used for errors that cause the fatal shutdown of any portion of the infrastructure.

Definition at line 36 of file LogMacros.h.

#define MADARA_LOG_ERROR   3

Used to log detailed error information at the point of failure.

Definition at line 45 of file LogMacros.h.

#define MADARA_LOG_EVENT_TRACE   7

Used to trace significant actions within major/minor events.

This will usually include starts for major/minor events.

Definition at line 55 of file LogMacros.h.

#define MADARA_LOG_MAJOR_DEBUG_INFO   8

Used to display important configuration information that impacts major MADARA events.

Definition at line 58 of file LogMacros.h.

#define MADARA_LOG_MAJOR_EVENT   5

Used to indicate that a ``significant'' MADARA event has completed.

Definition at line 50 of file LogMacros.h.

#define MADARA_LOG_MINOR_EVENT   6

Used to inficate a ``minor'' MADARA event has completed.

Definition at line 52 of file LogMacros.h.

#define MADARA_LOG_NONFATAL_ERROR   2

Used for non-fatal deployment errors that do not cause deployment failure.

Definition at line 43 of file LogMacros.h.

#define MADARA_LOG_TERMINAL_ERROR   1

Used for MADARA errors at the point the error exits the process in question, or when a decision is made to cause the MADARA suite to fail.

Definition at line 40 of file LogMacros.h.

#define MADARA_LOG_TRACE   9

The following two statements are used to closely trace the execution of MADARA code.

If in doubt, a message should go into these categories. The difference between a TRACE and a DETAILED_TRACE will be largely a judgement call. These messages should be emitted using MADARA_LOG_TRACE (X, Y).

Definition at line 64 of file LogMacros.h.

#define MADARA_LOG_WARNING   4

used to indicate that a questionable situation that doesn't cause deployment failure, but can cause undefined conditions.

Definition at line 48 of file LogMacros.h.

#define MADARA_NTRACE   1

Definition at line 69 of file LogMacros.h.

#define MADARA_TRACE (   X)    do {} while (0)

Definition at line 74 of file LogMacros.h.

Variable Documentation

ACE_Proper_Import_Flag int MADARA_debug_level

Definition at line 5 of file LogMacros.cpp.