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
12 * Zalanyi, Balazs Andor
15 ******************************************************************************/
16 #ifndef ILOGGER_PLUGIN_HH
17 #define ILOGGER_PLUGIN_HH
22 #include "Charstring.hh"
24 /// Forward declarations.
25 namespace TitanLoggerApi
34 major_version_(0), minor_version_(0), name_(NULL), help_(NULL), is_configured_(false) { }
35 virtual ~ILoggerPlugin() { }
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*/, ...) { }
43 virtual bool is_log2str_capable() { return false; }
44 virtual CHARSTRING log2str(const TitanLoggerApi::TitanLogEvent& /*event*/)
45 { return CHARSTRING(); }
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; }
54 virtual void log(const TitanLoggerApi::TitanLogEvent& event, bool log_buffered,
55 bool separate_file, bool use_emergency_mask) = 0;
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*/) { }
69 unsigned int major_version_;
70 unsigned int minor_version_;
76 #endif // ILOGGER_PLUGIN_HH