LoggingMacros_SLOGGING.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00026 //----------------------------------------------------------------------
00027 #ifndef ICL_CORE_LOGGING_LOGGING_MACROS__SLOGGING_H_INCLUDED
00028 #define ICL_CORE_LOGGING_LOGGING_MACROS__SLOGGING_H_INCLUDED
00029 
00030 #ifdef __ANDROID__
00031 #include <android/log.h>
00032 #include <sstream>
00033 #endif
00034 
00035 #ifdef __ANDROID__
00036 #define SLOGGING_LOG_FLCO(stream, level, filename, line, classname, objectname, arg)                                        \
00037   do {                                                                                                                      \
00038     if (stream.isActive())                                                                                                  \
00039     {                                                                                                                       \
00040       if (stream.getLogLevel() <= level)                                                                                    \
00041       {                                                                                                                     \
00042         std::stringstream str;                                                                                              \
00043         str << arg;                                                                                                         \
00044         switch (level) {                                                                                                    \
00045         case ::icl_core::logging::eLL_TRACE: __android_log_print(ANDROID_LOG_VERBOSE, stream.nameCStr(), str.str().c_str()); break; \
00046         case ::icl_core::logging::eLL_DEBUG: __android_log_print(ANDROID_LOG_DEBUG, stream.nameCStr(), str.str().c_str()); break;   \
00047         case ::icl_core::logging::eLL_INFO: __android_log_print(ANDROID_LOG_INFO, stream.nameCStr(), str.str().c_str()); break;     \
00048         case ::icl_core::logging::eLL_WARNING: __android_log_print(ANDROID_LOG_WARN, stream.nameCStr(), str.str().c_str()); break;  \
00049         default: __android_log_print(ANDROID_LOG_UNKNOWN, stream.nameCStr(), str.str().c_str()); break;                             \
00050         }                                                                                                                   \
00051       }                                                                                                                     \
00052     }                                                                                                                       \
00053   } while (0)
00054 #else
00055 #define SLOGGING_LOG_FLCO(stream, level, filename, line, classname, objectname, arg) \
00056   do {                                                                  \
00057     if (stream.isActive())                                              \
00058     {                                                                   \
00059       if (stream.getLogLevel() <= level)                                \
00060       {                                                                 \
00061         ::icl_core::logging::ThreadStream& thread_stream=stream.threadStream(level); \
00062         thread_stream.setLineLogLevel(level);                           \
00063         thread_stream.setFilename(filename);                            \
00064         thread_stream.setLine(line);                                    \
00065         thread_stream.setClassname(classname);                          \
00066         thread_stream.setObjectname(objectname);                        \
00067         thread_stream.setFunction(__FUNCTION__);                        \
00068         thread_stream << arg;                                           \
00069       }                                                                 \
00070     }                                                                   \
00071   } while (0)
00072 #endif
00073 #define SLOGGING_LOG_CO(stream, level, classname, objectname, arg) SLOGGING_LOG_FLCO(stream, level, __FILE__, __LINE__, #classname, objectname, arg)
00074 #define SLOGGING_LOG_C(stream, level, classname, arg) SLOGGING_LOG_FLCO(stream, level, __FILE__, __LINE__, #classname, "", arg)
00075 #define SLOGGING_LOG(stream, level, arg) SLOGGING_LOG_FLCO(stream, level, __FILE__, __LINE__, "", "", arg)
00076 
00077 
00078 #define SLOGGING_ERROR(stream, arg) SLOGGING_LOG(stream, ::icl_core::logging::eLL_ERROR, arg)
00079 #define SLOGGING_WARNING(stream, arg) SLOGGING_LOG(stream, ::icl_core::logging::eLL_WARNING, arg)
00080 #define SLOGGING_INFO(stream, arg) SLOGGING_LOG(stream, ::icl_core::logging::eLL_INFO, arg)
00081 #ifdef _IC_DEBUG_
00082 # define SLOGGING_DEBUG(stream, arg) SLOGGING_LOG(stream, ::icl_core::logging::eLL_DEBUG, arg)
00083 # define SLOGGING_TRACE(stream, arg) SLOGGING_LOG(stream, ::icl_core::logging::eLL_TRACE, arg)
00084 #else
00085 # define SLOGGING_DEBUG(stream, arg) (void)0
00086 # define SLOGGING_TRACE(stream, arg) (void)0
00087 #endif
00088 
00089 
00090 #define SLOGGING_ERROR_C(stream, classname, arg) SLOGGING_LOG_C(stream, ::icl_core::logging::eLL_ERROR, classname, arg)
00091 #define SLOGGING_WARNING_C(stream, classname, arg) SLOGGING_LOG_C(stream, ::icl_core::logging::eLL_WARNING, classname, arg)
00092 #define SLOGGING_INFO_C(stream, classname, arg) SLOGGING_LOG_C(stream, ::icl_core::logging::eLL_INFO,  classname, arg)
00093 #ifdef _IC_DEBUG_
00094 # define SLOGGING_DEBUG_C(stream, classname, arg) SLOGGING_LOG_C(stream, ::icl_core::logging::eLL_DEBUG, classname, arg)
00095 # define SLOGGING_TRACE_C(stream, classname, arg) SLOGGING_LOG_C(stream, ::icl_core::logging::eLL_TRACE, classname, arg)
00096 #else
00097 # define SLOGGING_DEBUG_C(stream, classname, arg) (void)0
00098 # define SLOGGING_TRACE_C(stream, classname, arg) (void)0
00099 #endif
00100 
00101 
00102 #define SLOGGING_ERROR_CO(stream, classname, objectname, arg) SLOGGING_LOG_CO(stream, ::icl_core::logging::eLL_ERROR, classname, objectname, arg)
00103 #define SLOGGING_WARNING_CO(stream, classname, objectname, arg) SLOGGING_LOG_CO(stream, ::icl_core::logging::eLL_WARNING, classname, objectname, arg)
00104 #define SLOGGING_INFO_CO(stream, classname, objectname, arg) SLOGGING_LOG_CO(stream, ::icl_core::logging::eLL_INFO, classname, objectname, arg)
00105 #ifdef _IC_DEBUG_
00106 # define SLOGGING_DEBUG_CO(stream, classname, objectname, arg) SLOGGING_LOG_CO(stream, ::icl_core::logging::eLL_DEBUG, classname, objectname, arg)
00107 # define SLOGGING_TRACE_CO(stream, classname, objectname, arg) SLOGGING_LOG_CO(stream, ::icl_core::logging::eLL_TRACE, classname, objectname, arg)
00108 #else
00109 # define SLOGGING_DEBUG_CO(stream, classname, objectname, arg) (void)0
00110 # define SLOGGING_TRACE_CO(stream, classname, objectname, arg) (void)0
00111 #endif
00112 
00113 
00114 #endif


fzi_icl_core
Author(s):
autogenerated on Tue Aug 8 2017 02:28:03