summaryrefslogtreecommitdiff
path: root/modules/CIAO/ciao/Logger/File_Logger_Backend.h
blob: 99b899484c21b7dbeae31d133100c73592dd6646 (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
46
47
48
49
50
51
52
// $Id$
#ifndef FILE_LOGGER_BACKEND_H_
#define FILE_LOGGER_BACKEND_H_

#include "ace/Log_Msg_Backend.h"
#include "ace/SString.h"
//#include "ace/String_Base.h"

#include "CIAO_Logger_Export.h"

namespace CIAO
  {

  class CIAO_Logger_Export LoggerError
    {
    public:
      LoggerError (const char * msg)
          : errmsg_ (msg) {};
      ACE_CString errmsg_;
    };

  class CIAO_Logger_Export File_Logger_Backend : public ACE_Log_Msg_Backend
    {
    public:
      File_Logger_Backend (const ACE_TCHAR * fname)
          : fh_ (0), filename_ (fname) {}

      virtual ~File_Logger_Backend (void)
      {
        this->close();
      };

      virtual int open (const ACE_TCHAR *logger_key);

      virtual int reset (void)
      {
        this->close();
        return this->open (0);
      };

      virtual int close (void);

      virtual ssize_t log (ACE_Log_Record &log_record);

    private:
      FILE * fh_;
      ACE_TString filename_;
    };

} // CIAO

#endif /*FILE_LOGGER_BACKEND_H_*/