summaryrefslogtreecommitdiff
path: root/polux/application/agent/inc/sm_agent_log_entry.h
diff options
context:
space:
mode:
Diffstat (limited to 'polux/application/agent/inc/sm_agent_log_entry.h')
-rw-r--r--polux/application/agent/inc/sm_agent_log_entry.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/polux/application/agent/inc/sm_agent_log_entry.h b/polux/application/agent/inc/sm_agent_log_entry.h
new file mode 100644
index 0000000000..ac8c6e6622
--- /dev/null
+++ b/polux/application/agent/inc/sm_agent_log_entry.h
@@ -0,0 +1,45 @@
+#ifndef __SM_AGENT_LOG_ENTRY_H__
+#define __SM_AGENT_LOG_ENTRY_H__
+
+#include <snmp_pp/log.h>
+#include <mib-interface.h>
+
+#ifdef REMOTE_LOG
+
+#ifndef _NO_LOGGING
+// Use this macro to use the SMAgentLogEntry operator+= specific methods
+// A typical use would be :
+// LOG_BEGIN(DEBUG_LOG);
+// SM_AGENT_LOG(...some stuff...);
+// LOG_END;
+//
+#define SM_AGENT_LOG(x) \
+ if ( dynamic_cast<SMAgentLogEntry*>(DefaultLog::log_entry()) ) { \
+ *(dynamic_cast<SMAgentLogEntry*>(DefaultLog::log_entry())) += x; \
+ }
+#else // _NO_LOGGING
+
+#define SM_AGENT_LOG(x) // do nothing
+#warning SM_AGENT_LOG macros have no effect without _NO_LOGGING enabled
+#endif // _NO_LOGGING
+
+/** \brief The SMAgentLogEntry add some functionnalities related
+ * to the sm-agent project to the LogEntryImpl class. This is
+ * for example the ability to log classes belonging to the
+ * sm-agent project.
+ */
+class SMAgentLogEntry : public LogEntryImpl {
+public:
+ SMAgentLogEntry(const char);
+
+ /** \brief display the content of the plc_host
+ * \param struct plc_host : the structure to display
+ */
+ virtual LogEntry& operator+=(const struct plc_host);
+};
+
+#else // REMOTE_LOG
+#define SM_AGENT_LOG(x) // do nothing
+#endif // REMOTE_LOG
+
+#endif // __SM_AGENT_LOG_H__