some bugfixes
This commit is contained in:
parent
bd76760052
commit
1531b8bda0
16
core.py
16
core.py
@ -40,6 +40,11 @@ def init_console_logger():
|
||||
generic_format = colorlog.ColoredFormatter(
|
||||
"%(log_color)s%(levelname)-8s | %(reset)s%(message)s%(reset)s"
|
||||
)
|
||||
fault_format = colorlog.ColoredFormatter(
|
||||
fmt="%(log_color)s%(levelname)-8s %(cyan)s%(asctime)s.%(msecs)03d "
|
||||
"[%(filename)s:%(lineno)d] %(reset)s%(message)s",
|
||||
datefmt="%Y-%m-%d %H:%M:%S",
|
||||
)
|
||||
|
||||
console_info_handler = colorlog.StreamHandler(stream=sys.stdout)
|
||||
console_info_handler.setLevel(logging.INFO)
|
||||
@ -52,16 +57,21 @@ def init_console_logger():
|
||||
console_info_handler.setFormatter(generic_format)
|
||||
console_info_handler.addFilter(InfoFilter())
|
||||
console_debug_handler.addFilter(DebugFilter())
|
||||
console_error_handler = logging.StreamHandler(stream=sys.stderr)
|
||||
console_error_handler.setLevel(logging.WARNING)
|
||||
console_error_handler.setFormatter(fault_format)
|
||||
|
||||
logger.addHandler(console_info_handler)
|
||||
logger.addHandler(console_debug_handler)
|
||||
logger.addHandler(console_error_handler)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
return logger
|
||||
|
||||
|
||||
class ParserTypes(enum.Enum):
|
||||
EVENTS = ("events",)
|
||||
OBJECTS = ("objects",)
|
||||
RETVALS = ("returnvalues",)
|
||||
EVENTS = "events"
|
||||
OBJECTS = "objects"
|
||||
RETVALS = "returnvalues"
|
||||
SUBSERVICES = "subservices"
|
||||
|
||||
|
||||
|
@ -153,6 +153,8 @@ class EventParser(FileParser):
|
||||
event_full_match.group(3)
|
||||
)
|
||||
severity = event_full_match.group(4)
|
||||
if self.obsw_root_path is not None:
|
||||
file_name = os.path.relpath(file_name, self.obsw_root_path)
|
||||
self.mib_table.update({full_id: (name, severity, description, file_name)})
|
||||
self.count = self.count + 1
|
||||
|
||||
|
@ -184,7 +184,7 @@ class FileParser:
|
||||
self.__debug_moving_window
|
||||
and self.__debug_moving_window_filename in file_name
|
||||
):
|
||||
print(f"Moving window post line anaylsis line {line_idx}")
|
||||
print(f"Moving window post line analysis line {line_idx}")
|
||||
print(moving_window)
|
||||
self._handle_file_parsing_moving_window(
|
||||
file_name, line_idx, moving_window_size, moving_window, *args, **kwargs
|
||||
|
@ -10,11 +10,14 @@ def copy_file(filename: str, destination: str = "", delete_existing_file: bool =
|
||||
if not os.path.exists(filename):
|
||||
LOGGER.warning(f"File {filename} does not exist")
|
||||
return
|
||||
if not os.path.exists(destination):
|
||||
LOGGER.warning(f"Destination directory {destination} does not exist")
|
||||
return
|
||||
if not os.path.isdir(destination) and os.path.exists(destination):
|
||||
if delete_existing_file:
|
||||
os.remove(destination)
|
||||
else:
|
||||
LOGGER.warning(f"Destination file {destination} already exists")
|
||||
return
|
||||
try:
|
||||
shutil.copy2(filename, destination)
|
||||
shutil.copy2(src=filename, dst=destination)
|
||||
except FileNotFoundError:
|
||||
LOGGER.exception("File not found!")
|
||||
except shutil.SameFileError:
|
||||
|
Loading…
x
Reference in New Issue
Block a user