sportran.utils.logger.PrintMethod¶
- class sportran.utils.logger.PrintMethod¶
Bases:
objectThis class is intended to manage all the messages that should be put in a file, in the stdout with print, or in any other place. Is has to be used as a global thing. It is just a routing point. In the whole library please use this. By default it is equivalent to a call to print()
- __init__()¶
Methods
__init__()append_method(method)append the method to the list.
close_file()open_file(fname)opens the log file that will be used globally
set_func(func)Set the function to call when
write_log()is called.set_method(method)Removes all method and set only the provided one
write_log(*args, **kwargs)Calls all the methods added by
append_method()- classmethod append_method(method)¶
append the method to the list. :param method: the method to be added to the method list, can be any of ‘bash’, ‘file’ or ‘other’ :type method: str if ‘file’ remember to call
open_file()somewhere
- classmethod open_file(fname)¶
opens the log file that will be used globally
- classmethod set_func(func)¶
Set the function to call when
write_log()is called. The function is called only if the ‘other’ method is setted byappend_method()orset_method()
- classmethod set_method(method)¶
Removes all method and set only the provided one
- classmethod write_log(*args, **kwargs)¶
Calls all the methods added by
append_method()