Apache Log4cxx  Version 1.1.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 {
101 class LOG4CXX_EXPORT SMTPAppender : public AppenderSkeleton
102 {
103  private:
104  struct SMTPPriv;
105  SMTPAppender(const SMTPAppender&);
106  SMTPAppender& operator=(const SMTPAppender&);
107  static bool asciiCheck(const LogString& value, const LogString& label);
108 
114  bool checkEntryConditions();
115 
116  public:
122 
128  SMTPAppender(log4cxx::helpers::Pool& p);
129 
134  SMTPAppender(spi::TriggeringEventEvaluatorPtr evaluator);
135 
137 
141  void setOption(const LogString& option, const LogString& value) override;
142 
147  void activateOptions(helpers::Pool& p) override;
148 
153  void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
154 
155 
156  void close() override;
157 
161  LogString getTo() const;
162 
166  LogString getCc() const;
167 
171  LogString getBcc() const;
172 
173 
177  bool requiresLayout() const override;
178 
182  void sendBuffer(log4cxx::helpers::Pool& p);
183 
184 
188  LogString getEvaluatorClass();
189 
193  LogString getFrom() const;
194 
198  LogString getSubject() const;
199 
200 
205  void setFrom(const LogString& from);
206 
211  void setSubject(const LogString& subject);
212 
220  void setBufferSize(int bufferSize);
221 
226  void setSMTPHost(const LogString& smtpHost);
227 
231  LogString getSMTPHost() const;
232 
237  void setSMTPPort(int port);
238 
242  int getSMTPPort() const;
243 
248  void setTo(const LogString& to);
249 
254  void setCc(const LogString& to);
255 
260  void setBcc(const LogString& to);
261 
262 
267  void setSMTPUsername(const LogString& newVal);
268 
272  LogString getSMTPUsername() const;
273 
278  void setSMTPPassword(const LogString& newVal);
279 
283  LogString getSMTPPassword() const;
284 
288  int getBufferSize() const;
289 
290 
295  log4cxx::spi::TriggeringEventEvaluatorPtr getEvaluator() const;
296 
301  void setEvaluator(log4cxx::spi::TriggeringEventEvaluatorPtr& trigger);
302 
310  void setEvaluatorClass(const LogString& value);
311 
316  void setLocationInfo(bool locationInfo);
317 
321  bool getLocationInfo() const;
322 }; // class SMTPAppender
323 
325 
326 } // namespace net
327 } // namespace log4cxx
328 
329 #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 when an ERROR level logging event is s...
Definition: smtpappender.h:102
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