Utils
timer
util function used to log the time taken by a part of program
Source code in Client/Responder/utils.py
39 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 75 76 77 78 79 80 81 |
|
__enter__()
context enter to start write this
Source code in Client/Responder/utils.py
58 59 60 61 62 63 64 |
|
__exit__(context, value, traceback)
context exit will write this
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context |
Optional[Type[BaseException]]
|
the context |
required |
value |
Optional[BaseException]
|
the value |
required |
traceback |
Optional[TracebackType]
|
the traceback |
required |
Source code in Client/Responder/utils.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
__init__(logger, message)
init the timer
Parameters:
Name | Type | Description | Default |
---|---|---|---|
logger |
Logger
|
the logger |
required |
message |
str
|
the message to be logged |
required |
Source code in Client/Responder/utils.py
44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
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]
|
the logger name |
None
|
stream |
bool
|
whether to log in the terminal stream |
True
|
Source code in Client/Responder/utils.py
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 |
|