Apache Log4cxx  Version 1.3.1
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_NS
27 {
28 namespace net
29 {
71 class LOG4CXX_EXPORT SMTPAppender : public AppenderSkeleton
72 {
73  private:
74  struct SMTPPriv;
75  SMTPAppender(const SMTPAppender&);
76  SMTPAppender& operator=(const SMTPAppender&);
77  static bool asciiCheck(const LogString& value, const LogString& label);
78 
84  bool checkEntryConditions();
85 
86  public:
92 
98  SMTPAppender(LOG4CXX_NS::helpers::Pool& p);
99 
104  SMTPAppender(spi::TriggeringEventEvaluatorPtr evaluator);
105 
107 
132  void setOption(const LogString& option, const LogString& value) override;
133 
144  void activateOptions(helpers::Pool& p) override;
145 
150  void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
151 
152 
153  void close() override;
154 
158  LogString getTo() const;
159 
163  LogString getCc() const;
164 
168  LogString getBcc() const;
169 
170 
174  bool requiresLayout() const override;
175 
179  void sendBuffer(LOG4CXX_NS::helpers::Pool& p);
180 
181 
185  LogString getEvaluatorClass();
186 
190  LogString getFrom() const;
191 
195  LogString getSubject() const;
196 
197 
202  void setFrom(const LogString& from);
203 
208  void setSubject(const LogString& subject);
209 
217  void setBufferSize(int bufferSize);
218 
223  void setSMTPHost(const LogString& smtpHost);
224 
228  LogString getSMTPHost() const;
229 
234  void setSMTPPort(int port);
235 
239  int getSMTPPort() const;
240 
245  void setTo(const LogString& to);
246 
251  void setCc(const LogString& to);
252 
257  void setBcc(const LogString& to);
258 
259 
264  void setSMTPUsername(const LogString& newVal);
265 
269  LogString getSMTPUsername() const;
270 
275  void setSMTPPassword(const LogString& newVal);
276 
280  LogString getSMTPPassword() const;
281 
285  int getBufferSize() const;
286 
287 
292  LOG4CXX_NS::spi::TriggeringEventEvaluatorPtr getEvaluator() const;
293 
298  void setEvaluator(LOG4CXX_NS::spi::TriggeringEventEvaluatorPtr& trigger);
299 
307  void setEvaluatorClass(const LogString& value);
308 
313  void setLocationInfo(bool locationInfo);
314 
318  bool getLocationInfo() const;
319 }; // class SMTPAppender
320 
322 
323 } // namespace net
324 } // namespace log4cxx
325 
326 #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:72
LOG4CXX_PTR_DEF(SMTPAppender)
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:31
std::basic_string< logchar > LogString
Definition: logstring.h:60
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:158
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:152
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:43
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:164
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:146