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