File: log.py

package info (click to toggle)
yade 2025.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,308 kB
  • sloc: cpp: 93,298; python: 50,409; sh: 577; makefile: 162
file content (35 lines) | stat: -rw-r--r-- 1,180 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# encoding: utf-8
# 2019 Janek Kozicki
# hint: follow changes in d067b0696a8 to add new modules.
"""
The ``yade.log`` module serves as an interface to yade logging framework implemented on top of `boost::log <https://www.boost.org/doc/libs/release/libs/log/>`_.
For full documentation see :ref:`debugging section<debugging>`. Example usage in python is as follows:

.. code-block:: python

	import yade.log
	yade.log.setLevel('PeriTriaxController',yade.log.TRACE)

Example usage in C++ is as follows:

.. code-block:: c++

	LOG_WARN("Something: "<<something)
"""

# all C++ functions are accessible now:
from yade._log import *

# some python functions can be added here too, like this one:
## def test():
## 	"""
## 	.. note:: This is a test.
## 	"""
## 	print("Test OK")

# Maybe add here python commands that would respect the filtering levels?
# They would just test the filter level and call the print(…) command.
# Their names would be LOG_FATAL(…), LOG_WARN(…) etc...
# Suppelement it with a python testAllLevelsPython(), like it is written in _log.cpp.
# And mention them in prog.rst.
# search if there is some kind of python logging library and use for this maybe?