log4tango  5.0.2
FileAppender.hh
Go to the documentation of this file.
1 //
2 // FileAppender.hh
3 //
4 // Copyright (C) : 2000 - 2002
5 // LifeLine Networks BV (www.lifeline.nl). All rights reserved.
6 // Bastiaan Bakker. All rights reserved.
7 //
8 // 2004,2005,2006,2007,2008,2009,2010,2011,2012
9 // Synchrotron SOLEIL
10 // L'Orme des Merisiers
11 // Saint-Aubin - BP 48 - France
12 //
13 // This file is part of log4tango.
14 //
15 // Log4ango is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU Lesser General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 // Log4tango is distributed in the hope that it will be useful,
21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 // GNU Lesser General Public License for more details.
24 //
25 // You should have received a copy of the GNU Lesser General Public License
26 // along with Log4Tango. If not, see <http://www.gnu.org/licenses/>.
27 
28 #ifndef _LOG4TANGO_FILEAPPENDER_H
29 #define _LOG4TANGO_FILEAPPENDER_H
30 
31 #include <log4tango/Portability.hh>
33 
34 namespace log4tango {
35 
36 //-----------------------------------------------------------------------------
37 // class : FileAppender
38 //-----------------------------------------------------------------------------
40 {
41 public:
42 
52  FileAppender(const std::string& name, const std::string& fileName,
53  bool append = true, mode_t mode = 00644);
54 
60  FileAppender(const std::string& name, int fd);
61 
65  virtual ~FileAppender();
66 
74  virtual bool reopen (void);
75 
79  virtual void close (void);
80 
86  virtual bool is_valid (void) const;
87 
96  virtual void set_append (bool append);
97 
101  virtual bool get_append (void) const;
102 
106  virtual void set_mode (mode_t mode);
107 
111  virtual mode_t get_mode() const;
112 
113 protected:
114 
115  virtual int _append (const LoggingEvent& event);
116 
117  const std::string _file_name;
118  int _fd;
119  int _flags;
120  mode_t _mode;
121 };
122 
123 } // namespace log4tango
124 
125 #endif // _LOG4TANGO_FILEAPPENDER_H
#define LOG4TANGO_EXPORT
Definition: Export.hh:38
Definition: FileAppender.hh:40
int _fd
Definition: FileAppender.hh:118
mode_t _mode
Definition: FileAppender.hh:120
int _flags
Definition: FileAppender.hh:119
const std::string _file_name
Definition: FileAppender.hh:117
Definition: LayoutAppender.hh:42
Definition: Appender.hh:40
The internal representation of logging events.
Definition: LoggingEvent.hh:51