Python bindings for g3log. The advantage is that you can use the same logger both in c++ and python, in a dual-language project.
g3logPython alternatives and similar packages
Based on the "Logging" category.
Alternatively, view g3logPython alternatives based on common mentions on social networks and blogs.
6.9 0.0 L4 g3logPython VS RavenRaven is the legacy Python client for Sentry (getsentry.com) — replaced by sentry-python
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of g3logPython or a related project?
This library provides python3 bindings for g3log + g3sinks (currently logrotate, syslog, and a color-terminal output). Calls can be made both from python and C++, retaining the thread-safety of g3log. The advantage is that you can use the same logger both in c++ and python parts of a multi-language project. Note that this project is made of two parts:
- a binding layer in C++
- a python wrapper aroung the binding layer, using pybind11
The binding layer modifies the interface of g3log+sinks to make it easily wrappable with pybind11. Exported methods from the binding layer can also be called from C++, providing a different interface to g3log.
Build and Install
git clone https://github.com/JoelStienlet/g3logPython
For the C++ bindings:
mkdir build_bindings && cd build_bindings && cmake .. && make && sudo make install
Then build the python wrapper:
python3 setup.py install
See the Examples directory for more advanced usage, and examples of different sink backends.
#!/usr/bin/env python3 import g3logPython as log logger = log.get_ifaceLogWorker(False) journaldSink = logger.SysLogSinks.new_Sink("journald","id=g3logPython") journaldSink.echoToStderr() log.debug("hello world!")
Technical aspects are described on this page.
*Note that all licence references and agreements mentioned in the g3logPython README section above are relevant to that project's source code only.