ChimeraTK-ApplicationCore 04.06.00
Loading...
Searching...
No Matches
PyLogger.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3#pragma once
4
5#include <pybind11/pybind11.h>
6// pybind11.h must come first
7
8#include "Logger.h"
9
10namespace py = pybind11;
11
12namespace ChimeraTK {
13
14 /********************************************************************************************************************/
15
16 class PyLogger {
17 public:
18 static void bind(py::module& mod);
19 };
20
21 /********************************************************************************************************************/
22
29 public:
30 PyLoggerStreamProxy(Logger::Severity severity, std::string context)
31 : _severity(severity), _context(std::move(context)) {}
32
33 void log(const std::string& message) { ChimeraTK::logger(_severity, _context) << message; }
34
35 private:
36 Logger::Severity _severity;
37 std::string _context;
38 };
39
40 /********************************************************************************************************************/
41
42} // namespace ChimeraTK
Severity
Severity levels used by the Logger.
Definition Logger.h:27
static void bind(py::module &mod)
Definition PyLogger.cc:12
PyLoggerStreamProxy.
Definition PyLogger.h:28
PyLoggerStreamProxy(Logger::Severity severity, std::string context)
Definition PyLogger.h:30
void log(const std::string &message)
Definition PyLogger.h:33
InvalidityTracer application module.
Logger::StreamProxy logger(Logger::Severity severity, std::string context)
Convenience function to obtain the logger stream.
Definition Logger.h:124
module_ module