Belle II Software light-2406-ragdoll
LogPythonInterface.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <framework/logging/LogConfig.h>
12
13#include <boost/python/dict.hpp>
14
15#include <string>
16
17namespace Belle2 {
45 public:
48
55
62
68 void setDebugLevel(int level);
69
76 void setLogInfo(LogConfig::ELogLevel level, int info);
77
84 void setPackageLogConfig(const std::string& package, const LogConfig& config);
85
91 void setMaxMessageRepetitions(unsigned repetitions);
92
99
106
112 int getDebugLevel();
113
121
128 LogConfig& getPackageLogConfig(const std::string& package);
129
135 unsigned getMaxMessageRepetitions() const;
136
143 void addLogFile(const std::string& filename, bool append = false);
144
148 void addLogConsole();
149
156 void addLogJSON(bool complete);
157
158
164 void addLogUDP(const std::string& hostname, unsigned short port);
165
171 void addLogConsole(bool color);
172
176 void reset();
177
181 void zeroCounters();
182
184 void enableErrorSummary(bool on);
185
189 void setPythonLoggingEnabled(bool enabled) const;
190
194 bool getPythonLoggingEnabled() const;
195
199 void setEscapeNewlinesEnabled(bool enabled) const;
200
204 bool getEscapeNewlinesEnabled() const;
205
212 static boost::python::object logDebug(boost::python::tuple args, const boost::python::dict& kwargs);
219 static boost::python::object logInfo(boost::python::tuple args, const boost::python::dict& kwargs);
220
227 static boost::python::object logResult(boost::python::tuple args, const boost::python::dict& kwargs);
234 static boost::python::object logWarning(boost::python::tuple args, const boost::python::dict& kwargs);
241 static boost::python::object logError(boost::python::tuple args, const boost::python::dict& kwargs);
242
249 static boost::python::object logFatal(boost::python::tuple args, const boost::python::dict& kwargs);
250
252 boost::python::dict getLogStatistics();
254 static void exposePythonAPI();
255 protected:
256 };
257
259} // end namespace Belle2
The LogConfig class.
Definition: LogConfig.h:22
ELogLevel
Definition of the supported log levels.
Definition: LogConfig.h:26
Thin wrapper to expose a usable interface to the logging framework in python.
bool getEscapeNewlinesEnabled() const
Get flag if newlines in log messages to console should be replaced by ' '`.
void setDebugLevel(int level)
Set the debug messaging level.
void setAbortLevel(LogConfig::ELogLevel level)
Set the abort log level.
static boost::python::object logFatal(boost::python::tuple args, const boost::python::dict &kwargs)
Produce fatal message.
int getLogInfo(LogConfig::ELogLevel level)
Get the printed log information for the given level.
boost::python::dict getLogStatistics()
return dict with log statistics
void setPackageLogConfig(const std::string &package, const LogConfig &config)
Set LogConfig for a given package.
void addLogFile(const std::string &filename, bool append=false)
Add a file as output connection.
void setPythonLoggingEnabled(bool enabled) const
Set flag if logging should be done via python sys.stdout
LogConfig::ELogLevel getAbortLevel()
Get the abort level.
static boost::python::object logWarning(boost::python::tuple args, const boost::python::dict &kwargs)
Produce warning message.
static void exposePythonAPI()
expose python API
bool getPythonLoggingEnabled() const
Get flag if logging should be done via python sys.stdout
void enableErrorSummary(bool on)
Enable/Disable error summary.
void setMaxMessageRepetitions(unsigned repetitions)
Set maximum number of repetitions before silencing "identical" log messages.
static boost::python::object logDebug(boost::python::tuple args, const boost::python::dict &kwargs)
Produce debug message.
void addLogConsole()
Add the console as output connection.
void addLogUDP(const std::string &hostname, unsigned short port)
Add a UDP server as an output connection.
void setLogLevel(LogConfig::ELogLevel level)
Set the log level.
int getDebugLevel()
Get the debug level.
void reset()
Reset logging connections.
static boost::python::object logInfo(boost::python::tuple args, const boost::python::dict &kwargs)
Produce info message.
void addLogJSON(bool complete)
Add the console as output connection but print the log messages as json objects so that they can be p...
void setLogInfo(LogConfig::ELogLevel level, int info)
Set the printed log information for the given level.
unsigned getMaxMessageRepetitions() const
Get maximum number of repetitions before silencing "identical" log messages.
void setEscapeNewlinesEnabled(bool enabled) const
Set flag if newlines in log messages to console should be replaced by ' '.
LogConfig & getPackageLogConfig(const std::string &package)
Get the LogConfig for the given package.
void zeroCounters()
Reset logging counters.
static boost::python::object logError(boost::python::tuple args, const boost::python::dict &kwargs)
Produce error message.
static boost::python::object logResult(boost::python::tuple args, const boost::python::dict &kwargs)
Produce result message.
LogConfig::ELogLevel getLogLevel()
Get the log level.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24