Sync with 5.4.0
[deliverable/titan.core.git] / loggerplugins / JUnitLogger / JUnitLogger.hh
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2015 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
8 #ifndef JUnitLogger_HH
9 #define JUnitLogger_HH
10
11 namespace TitanLoggerApi { class TitanLogEvent; }
12
13 #include "ILoggerPlugin.hh"
14 #include <stdio.h>
15
16 class JUnitLogger: public ILoggerPlugin
17 {
18 public:
19 JUnitLogger();
20 virtual ~JUnitLogger();
21 inline bool is_static() { return false; }
22 void init(const char *options = 0);
23 void fini();
24
25 void log(const TitanLoggerApi::TitanLogEvent& event, bool log_buffered,
26 bool separate_file, bool use_emergency_mask);
27 void set_parameter(const char *parameter_name, const char *parameter_value);
28 // do not implement ILoggerPlugin::set_file_name();
29 // it gets a filename skeleton and can't expand it.
30
31 virtual void open_file(bool /*is_first*/);
32 virtual void close_file();
33
34 enum xml_escape_char_t { LT=0x01, GT=0x02, QUOT=0x04, APOS=0x08, AMP=0x10 };
35 CHARSTRING escape_xml(const CHARSTRING& xml_str, int escape_chars);
36 CHARSTRING escape_xml_attribute(const CHARSTRING& attr_str) { return escape_xml(attr_str, QUOT|AMP); }
37 CHARSTRING escape_xml_element(const CHARSTRING& elem_str) { return escape_xml(elem_str, LT|AMP); }
38 CHARSTRING escape_xml_comment(const CHARSTRING& comm_str) { return escape_xml(comm_str, AMP); /* FIXME: --> should be escaped too */ }
39
40 private:
41 // parameters
42 char *filename_stem_;
43 char *testsuite_name_;
44 // working values
45 char *filename_;
46 FILE *file_stream_;
47 };
48
49 #endif // JUnitLogger_HH
This page took 0.032166 seconds and 5 git commands to generate.