Commit | Line | Data |
---|---|---|
970ed795 | 1 | /////////////////////////////////////////////////////////////////////////////// |
3abe9331 | 2 | // Copyright (c) 2000-2015 Ericsson Telecom AB |
970ed795 EL |
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 ILOGGER_PLUGIN_HH | |
9 | #define ILOGGER_PLUGIN_HH | |
10 | ||
11 | #include "Types.h" | |
12 | #include "Logger.hh" | |
13 | #include "TTCN3.hh" | |
14 | #include "Charstring.hh" | |
15 | ||
16 | /// Forward declarations. | |
17 | namespace TitanLoggerApi | |
18 | { | |
19 | class TitanLogEvent; | |
20 | } | |
21 | ||
22 | class ILoggerPlugin | |
23 | { | |
24 | public: | |
25 | ILoggerPlugin() : | |
26 | major_version_(0), minor_version_(0), name_(NULL), help_(NULL), is_configured_(false) { } | |
27 | virtual ~ILoggerPlugin() { } | |
28 | ||
29 | virtual bool is_static() = 0; | |
30 | virtual void init(const char *options = NULL) = 0; | |
31 | virtual void fini() = 0; | |
32 | virtual void reset() { } | |
33 | virtual void fatal_error(const char */*err_msg*/, ...) { } | |
34 | ||
35 | virtual bool is_log2str_capable() { return false; } | |
36 | virtual CHARSTRING log2str(const TitanLoggerApi::TitanLogEvent& /*event*/) | |
37 | { return CHARSTRING(); } | |
38 | ||
39 | inline unsigned int major_version() const { return this->major_version_; } | |
40 | inline unsigned int minor_version() const { return this->minor_version_; } | |
41 | inline const char *plugin_name() const { return this->name_; } | |
42 | inline const char *plugin_help() const { return this->help_; } | |
43 | inline bool is_configured() const { return this->is_configured_; } | |
44 | inline void set_configured(bool configured) { this->is_configured_ = configured; } | |
45 | ||
46 | virtual void log(const TitanLoggerApi::TitanLogEvent& event, bool log_buffered, | |
47 | bool separate_file, bool use_emergency_mask) = 0; | |
48 | ||
49 | /// Backward compatibility functions. | |
50 | virtual void open_file(bool /*is_first*/) { } | |
51 | virtual void close_file() { } | |
52 | virtual void set_file_name(const char */*new_filename_skeleton*/, | |
53 | bool /*from_config*/) { } | |
54 | virtual void set_append_file(bool /*new_append_file*/) { } | |
55 | virtual bool set_file_size(int /*size*/) { return false; } | |
56 | virtual bool set_file_number(int /*number*/) { return false; } | |
57 | virtual bool set_disk_full_action(TTCN_Logger::disk_full_action_t /*disk_full_action*/) { return false; } | |
58 | virtual void set_parameter(const char */*parameter_name*/, const char */*parameter_value*/) { } | |
59 | ||
60 | protected: | |
61 | unsigned int major_version_; | |
62 | unsigned int minor_version_; | |
63 | char *name_; | |
64 | char *help_; | |
65 | bool is_configured_; | |
66 | }; | |
67 | ||
68 | #endif // ILOGGER_PLUGIN_HH |