Skip to content

5l1v3r1/g3logPython

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status GitHub license codecov Percentage of issues still open CodeFactor

g3logPython

Python bindings for g3log

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.

License

Unlicense license

Build and Install

For the C++ bindings:

mkdir build_bindings && cd build_bindings && cmake .. && make && sudo make install

Then build the python wrapper:

python3 setup.py install

Example

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

Technical aspects are described on this page.

Other ressources

links to similar projects

About

Python bindings for g3log

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 75.7%
  • Python 13.9%
  • Shell 7.2%
  • CMake 3.2%