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 LOGGER_PLUGIN_HH
17 #define LOGGER_PLUGIN_HH
22 namespace TitanLoggerApi
30 // Factory functions to create and destroy dynamic logger plug-ins.
31 typedef ILoggerPlugin *(*cb_create_plugin)(void);
32 typedef void (*cb_destroy_plugin)(ILoggerPlugin *plugin);
36 friend class LoggerPluginManager;
38 explicit LoggerPlugin(const char *path);
39 explicit LoggerPlugin(cb_create_plugin *create);
46 void set_file_name(const char *new_filename_skeleton, bool from_config);
47 void set_component(const component comp, const char *name);
48 void set_append_file(bool new_append_file);
49 void open_file(bool is_first);
51 bool set_file_size(int p_size);
52 bool set_file_number(int p_number);
53 bool set_disk_full_action(TTCN_Logger::disk_full_action_t p_disk_full_action);
54 void set_parameter(const char* param_name, const char* param_value);
56 int log(const TitanLoggerApi::TitanLogEvent& event, bool log_buffered,
57 bool separate_file, bool use_emergency_mask);
58 inline bool is_log2str_capable() const { return this->is_log2str_capable_; }
59 CHARSTRING log2str(const TitanLoggerApi::TitanLogEvent& event) const;
60 const char *plugin_name() const;
61 bool is_configured() const;
62 void set_configured(bool configured);
65 explicit LoggerPlugin(const LoggerPlugin&);
66 LoggerPlugin& operator=(const LoggerPlugin&);
68 const char *filename() const { return this->filename_; }
70 ILoggerPlugin *ref_; // The plug-in instance.
71 void *handle_; // Shared library handle, NULL for static plug-ins.
72 char *filename_; // Linker name of the plug-in, NULL for static plug-ins.
73 cb_create_plugin create_; // Creator of static plug-ins, NULL otherwise.
74 bool is_log2str_capable_; // True if plugin provides log2str().
77 #endif // LOGGER_PLUGIN_HH