Use new log.format_log_path sub_dir option
This removes the need to import time
This commit is contained in:
parent
b9c4c9c32f
commit
670619b65e
2 changed files with 9 additions and 15 deletions
|
|
@ -7,7 +7,6 @@ import logging
|
|||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from random import randint
|
||||
|
||||
|
|
@ -219,14 +218,10 @@ def main() -> None:
|
|||
args = docopt(DOCSTRING)
|
||||
|
||||
# Log setup
|
||||
log_dir = log.format_log_path()
|
||||
log_dir = pathlib.Path(
|
||||
f'{log_dir.parent}/'
|
||||
f'ddrescue-TUI_{time.strftime("%Y-%m-%d_%H%M%S%z")}/'
|
||||
)
|
||||
log_path = log.format_log_path(log_name='main', sub_dir='ddrescue-TUI')
|
||||
log.update_log_path(
|
||||
dest_dir=log_dir,
|
||||
dest_name='main',
|
||||
dest_dir=log_path.parent,
|
||||
dest_name=log_path.stem,
|
||||
keep_history=False,
|
||||
timestamp=False,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import logging
|
|||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from docopt import docopt
|
||||
|
||||
|
|
@ -130,17 +129,17 @@ class State():
|
|||
self.test_groups.clear()
|
||||
|
||||
# Set log
|
||||
self.log_dir = log.format_log_path()
|
||||
self.log_dir = pathlib.Path(
|
||||
f'{self.log_dir.parent}/'
|
||||
f'Hardware-Diagnostics_{time.strftime("%Y-%m-%d_%H%M%S%z")}/'
|
||||
self.log_dir = log.format_log_path(
|
||||
log_name='main',
|
||||
sub_dir='Hardware-Diagnostics',
|
||||
)
|
||||
log.update_log_path(
|
||||
dest_dir=self.log_dir,
|
||||
dest_name='main',
|
||||
dest_dir=self.log_dir.parent,
|
||||
dest_name=self.log_dir.stem,
|
||||
keep_history=False,
|
||||
timestamp=False,
|
||||
)
|
||||
self.log_dir = self.log_dir.parent
|
||||
cli.clear_screen()
|
||||
cli.print_info('Initializing...')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue