summaryrefslogtreecommitdiff
path: root/polux/application/agent/inc/sm_agent_log_entry.h
blob: ac8c6e6622b5f47b62f1eddccebc1e9cb5c00d4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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__