5.4. common module
- class capture_it.common.Log
Bases:
object
Execution Debug Logging class
- add_host(hostname)
adds a device ip address (hostname) to Logging dictionary
- Parameters:
hostname (str) – device ip/hostname
- add_log(hostname, msg)
appends log message msg to given hostname/ip log list.
- Parameters:
hostname (str) – device ip/hostname
msg (str) – log message
- get_log(hostname)
retrive log for given ip/hostname
- Parameters:
hostname (str) – device ip/hostname
- Returns:
multiline host logging entries.
- Return type:
str
- get_logs()
retrive log for all hosts/ips
- Returns:
multiline host logging entries.
- Return type:
str
- write_individuals(capture_folder)
write out log for all devices to each individual files at given capture folder.
- Parameters:
capture_folder (str) – path / location to where all device log to be written.
- write_log(file)
write out log for all devices to given file.
- Parameters:
file (str) – filename/with location to write log out to.
- capture_it.common.juniper_add_no_more(cmd)
returns updated juniper command with proper full | no-more statement if missing or trunkated found.
- Parameters:
cmd (str) – juniper show command
- Returns:
updated command with | no-more
- Return type:
str
- capture_it.common.visual_print(msg, msg_level, visual_progress, logger_list)
Prints message on console based on input visual progress level. If input visual progress level is greater or equal to msg_level then the message (msg) will be printed.
- Parameters:
msg (str) – message to be printed on console
msg_level (int) – static message level for the particular message
visual_progress (int) – visual progress level number
logger (list) – device logging messages list
- Returns:
None
- capture_it.common.write_log(lg, log_type, common_log_file, capture_folder)
writes Logger output to a text log file(s).
- Parameters:
lg (Log) – Logger class from common module
log_type (str) – what type of log output requires. choices are = common, individual, both
common_log_file (str) – output file name of a common log file
capture_folder (str) – output capture folder where log(s) will also be generated.
- Returns:
None