SND@LHC Software
Loading...
Searching...
No Matches
logger Namespace Reference

Functions

 _make_wrapper (funcname)
 
 _add_wrappers ()
 

Function Documentation

◆ _add_wrappers()

logger._add_wrappers ( )
protected

Definition at line 22 of file logger.py.

22def _add_wrappers():
23 # This function is used to avoid polluting the global namespace
24 for funcname in ('fatal', 'error', 'warn', 'info', 'debug'):
25 function, docstring = _make_wrapper(funcname)
26 globals()[funcname] = function
27 globals()[funcname].__doc__ = docstring
28

◆ _make_wrapper()

logger._make_wrapper (   funcname)
protected

Definition at line 8 of file logger.py.

8def _make_wrapper(funcname):
9 def function(*args, **kwargs):
10 delim = kwargs.get('delim', ' ')
11 # Interleaves arguments with delimiters. No delimiter at the end.
12 args_with_delim = [val for pair in zip(args, len(args)*[delim]) for val in pair][:-1]
13 return ROOT.ship.__dict__[funcname](*map(type, args_with_delim))(*args_with_delim)
14 docstring = '''\
15 Python wrapper around the C++ function template ship::{}(Types... args).
16
17 Keyword arguments:
18 delim -- delimiter to be inserted between each argument (default \' \')
19 '''.format(funcname)
20 return function, docstring
21