1 #ifndef APG_CALLBACK3_H
2 #define APG_CALLBACK3_H
4 #include "ace/streams.h"
5 #include "ace/CDR_Stream.h"
6 #include "ace/Log_Msg.h"
7 #include "ace/Log_Msg_Callback.h"
8 #include "ace/Log_Record.h"
9 #include "ace/SOCK_Stream.h"
10 #include "ace/SOCK_Connector.h"
11 #include "ace/INET_Addr.h"
13 #define LOGGER_PORT 20009
15 class Callback
: public ACE_Log_Msg_Callback
20 this->logger_
= new ACE_SOCK_Stream
;
21 ACE_SOCK_Connector connector
;
22 ACE_INET_Addr
addr (LOGGER_PORT
, ACE_DEFAULT_SERVER_HOST
);
24 if (connector
.connect (*(this->logger_
), addr
) == -1)
35 this->logger_
->close ();
40 void log (ACE_Log_Record
&log_record
)
44 # if defined (ACE_LACKS_IOSTREAM_TOTALLY)
45 log_record
.print (ACE_TEXT (""), ACE_Log_Msg::VERBOSE
, stderr
);
47 log_record
.print(ACE_TEXT (""), ACE_Log_Msg::VERBOSE
, cerr
);
48 # endif /* ACE_LACKS_IOSTREAM_TOTALLY */
54 if (this->logger_
->send_n (cdr
.begin ()) == -1)
62 ACE_SOCK_Stream
*logger_
;
65 #endif /* APG_CALLBACK3_H */