ATLAS Offline Software
PyLogger.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id: PyLogger.h,v 1.1 2007-12-15 06:54:27 ssnyder Exp $
8 
17 #ifndef ROOTUTILS_PYLOGGER_H
18 #define ROOTUTILS_PYLOGGER_H
19 
20 
21 #ifdef _POSIX_C_SOURCE
22 # undef _POSIX_C_SOURCE
23 #endif
24 #include "Python.h"
25 
26 #include "RootUtils/ILogger.h"
27 
28 
29 namespace RootUtils {
30 
31 
35 class PyLogger
36  : public RootUtils::ILogger
37 {
38 public:
47  PyLogger (PyObject* debugfn, PyObject* errorfn);
48 
49 
51  ~PyLogger();
52 
53 
58  virtual void debug (const char* msg);
59 
60 
65  virtual void error (const char* msg);
66 
67 
68 private:
76  static void call (PyObject* fn, const char* msg);
77 
78 
81 
84 };
85 
86 
87 } // namespace RootUtils
88 
89 
90 #endif // not ROOTUTILS_PYLOGGER_H
RootUtils
Definition: ILogger.h:20
RootUtils::PyLogger::m_debugfn
PyObject * m_debugfn
The debug message function.
Definition: PyLogger.h:80
RootUtils::PyLogger
A concrete implementation of ILogger that calls back to Python.
Definition: PyLogger.h:37
RootUtils::PyLogger::PyLogger
PyLogger(PyObject *debugfn, PyObject *errorfn)
Constructor.
Definition: PyLogger.cxx:27
RootUtils::PyLogger::debug
virtual void debug(const char *msg)
Log a debugging message.
Definition: PyLogger.cxx:50
RootUtils::PyLogger::m_errorfn
PyObject * m_errorfn
The error message function.
Definition: PyLogger.h:83
python.getCurrentFolderTag.fn
fn
Definition: getCurrentFolderTag.py:65
RootUtils::PyLogger::error
virtual void error(const char *msg)
Log an error message.
Definition: PyLogger.cxx:60
RootUtils::PyLogger::call
static void call(PyObject *fn, const char *msg)
Common code to call Python callback.
Definition: PyLogger.cxx:73
RootUtils::ILogger
Very simple interface for writing log messages.
Definition: ILogger.h:34
PyObject
_object PyObject
Definition: IPyComponent.h:26
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
RootUtils::PyLogger::~PyLogger
~PyLogger()
Destructor.
Definition: PyLogger.cxx:39
ILogger.h
Very simple interface for writing log messages.