Apache Log4cxx  Version 1.0.0
smtpappender.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _LOG4CXX_NET_SMTP_H
19 #define _LOG4CXX_NET_SMTP_H
20 
21 
25 
26 namespace log4cxx
27 {
28 namespace net
29 {
40 class LOG4CXX_EXPORT SMTPAppender : public AppenderSkeleton
41 {
42  private:
43  struct SMTPPriv;
44  SMTPAppender(const SMTPAppender&);
45  SMTPAppender& operator=(const SMTPAppender&);
46  static bool asciiCheck(const LogString& value, const LogString& label);
47 
53  bool checkEntryConditions();
54 
55  public:
61 
67  SMTPAppender(log4cxx::helpers::Pool& p);
68 
73  SMTPAppender(spi::TriggeringEventEvaluatorPtr evaluator);
74 
76 
80  void setOption(const LogString& option, const LogString& value) override;
81 
86  void activateOptions(helpers::Pool& p) override;
87 
92  void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
93 
94 
95  void close() override;
96 
100  LogString getTo() const;
101 
105  LogString getCc() const;
106 
110  LogString getBcc() const;
111 
112 
116  bool requiresLayout() const override;
117 
121  void sendBuffer(log4cxx::helpers::Pool& p);
122 
123 
127  LogString getEvaluatorClass();
128 
132  LogString getFrom() const;
133 
137  LogString getSubject() const;
138 
139 
144  void setFrom(const LogString& from);
145 
150  void setSubject(const LogString& subject);
151 
159  void setBufferSize(int bufferSize);
160 
165  void setSMTPHost(const LogString& smtpHost);
166 
170  LogString getSMTPHost() const;
171 
176  void setSMTPPort(int port);
177 
181  int getSMTPPort() const;
182 
187  void setTo(const LogString& to);
188 
193  void setCc(const LogString& to);
194 
199  void setBcc(const LogString& to);
200 
201 
206  void setSMTPUsername(const LogString& newVal);
207 
211  LogString getSMTPUsername() const;
212 
217  void setSMTPPassword(const LogString& newVal);
218 
222  LogString getSMTPPassword() const;
223 
227  int getBufferSize() const;
228 
229 
234  log4cxx::spi::TriggeringEventEvaluatorPtr getEvaluator() const;
235 
240  void setEvaluator(log4cxx::spi::TriggeringEventEvaluatorPtr& trigger);
241 
249  void setEvaluatorClass(const LogString& value);
250 
255  void setLocationInfo(bool locationInfo);
256 
260  bool getLocationInfo() const;
261 }; // class SMTPAppender
262 
264 
265 } // namespace net
266 } // namespace log4cxx
267 
268 #endif // _LOG4CXX_NET_SMTP_H
Implementation base class for all appenders.
Definition: appenderskeleton.h:41
Send an e-mail when a specific logging event occurs, typically on errors or fatal errors.
Definition: smtpappender.h:41
LOG4CXX_PTR_DEF(SMTPAppender)
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:31
Definition: appender.h:27
std::basic_string< logchar > LogString
Definition: logstring.h:60
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:157
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:151
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:42
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:163
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:145