diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-03-05 11:21:58 +0100 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-03-05 11:21:58 +0100 |
commit | 7f167c2314fd1b977f7b9afbf3b778b9cc9ef291 (patch) | |
tree | 950205ce6bbee7afb732e8bb66183c5068fdc843 | |
parent | initial commit (diff) | |
download | audit-scripts-7f167c2314fd1b977f7b9afbf3b778b9cc9ef291.tar.gz audit-scripts-7f167c2314fd1b977f7b9afbf3b778b9cc9ef291.zip |
writable_dirs: use process names in the log
-rwxr-xr-x | writable_dirs.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/writable_dirs.py b/writable_dirs.py index 39a0f40..8313707 100755 --- a/writable_dirs.py +++ b/writable_dirs.py @@ -18,7 +18,7 @@ import sys def console_log_formatter(): - fmt = '%(asctime)s | %(process)d | %(levelname)s | %(message)s' + fmt = '%(asctime)s | %(processName)s | %(levelname)s | %(message)s' datefmt = '%Y-%m-%d %H:%M:%S' return logging.Formatter(fmt=fmt, datefmt=datefmt) @@ -36,6 +36,8 @@ def console_log_handler(): @contextlib.contextmanager def launch_logging_thread(queue): + process = mp.current_process() + process.name = 'scandir' listener = logging.handlers.QueueListener(queue, console_log_handler()) listener.start() try: @@ -260,7 +262,8 @@ def main(argv=None): scandir_queue = mp.SimpleQueue() access_process_args = prog_args, log_queue, access_queue, scandir_queue access_process = mp.Process(target=access_main, - args=access_process_args) + args=access_process_args, + name='access') access_queue.put([prog_args.root_dir]) access_process.start() scandir_main(access_queue, scandir_queue) |