Mantid
Loading...
Searching...
No Matches
PythonLoggingChannel.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7//
8// PythonLoggingChannel.h
9//
10// Channel for logging. Sends messages to Python's standard library logging framework.
11// Usage: use it in Mantid.properties or mantid.user.properties in addition to, or
12// instead of other channel classes.
13//
14
15#pragma once
16
17// local includes
18#include "MantidPythonInterface/core/DllConfig.h"
19
20// 3rd-party includes
21#include <Poco/Channel.h>
22#include <memory>
23
24namespace Poco {
25
26class MANTID_PYTHONINTERFACE_CORE_DLL PythonLoggingChannel : public Poco::Channel {
27public:
29 ~PythonLoggingChannel() override;
30 // Because of boost::python::object
33 // Because of Poco::Channel
36
37 void log(const Poco::Message &msg) override;
38 void log(Poco::Message &&msg) override;
39 void close() override;
40 void flush();
41
42private:
43 struct State;
44
45 void closeImpl();
46 void enqueue(Poco::Message &&msg);
49 static int pendingCallDrainQueue(void *stateHolder);
51 static void drainQueue(State &state);
52
54 const std::shared_ptr<State> m_state;
55};
56
57} // namespace Poco
const std::shared_ptr< State > m_state
Shared with any outstanding pending calls. It is set in the constructor and never reset.
PythonLoggingChannel & operator=(PythonLoggingChannel &&)=delete
PythonLoggingChannel(PythonLoggingChannel &&)=delete
PythonLoggingChannel & operator=(const PythonLoggingChannel &)=delete
PythonLoggingChannel(const PythonLoggingChannel &)=delete