Utils
timer
util function used to log the time taken by a part of program
Source code in Client/Listener/utils.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
__enter__()
context enter to start write this
Source code in Client/Listener/utils.py
61 62 63 64 65 66 67 |
|
__exit__(context, value, traceback)
context exit will write this
Source code in Client/Listener/utils.py
69 70 71 72 73 74 |
|
__init__(logger, message)
init the timer
Parameters:
Name | Type | Description | Default |
---|---|---|---|
logger |
Logger
|
Logger the logger to log the message |
required |
message |
str
|
str the message to log |
required |
Source code in Client/Listener/utils.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
get_logger(logger_name=None, stream=True)
init the logger, give it proper format, log them both in terminal stream and file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
logger_name |
Optional[str]
|
str the name of the logger |
None
|
stream |
bool
|
bool whether to log in the terminal stream |
True
|
Source code in Client/Listener/utils.py
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 36 37 |
|