Skip to content

Commit

Permalink
simplify entrypoint logging
Browse files Browse the repository at this point in the history
no need to show func name
  • Loading branch information
Fallen-Breath committed Dec 9, 2023
1 parent 0b7800b commit 0e80915
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions prime_backup/cli/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from pathlib import Path
from typing import Type

from prime_backup.action.export_backup_action import ExportBackupToDirectoryAction, ExportBackupToTarAction, ExportBackupToZipAction
from prime_backup.action.export_backup_action import ExportBackupToDirectoryAction, ExportBackupToTarAction, \
ExportBackupToZipAction
from prime_backup.action.get_backup_action import GetBackupAction
from prime_backup.action.get_db_overview_action import GetDbOverviewAction
from prime_backup.action.get_file_action import GetFileAction
Expand All @@ -21,8 +22,11 @@
from prime_backup.types.standalone_backup_format import StandaloneBackupFormat
from prime_backup.types.tar_format import TarFormat
from prime_backup.types.units import ByteCount
from prime_backup.utils import log_utils

logger = get_logger()
assert len(logger).handlers == 1
logger.handlers[0].setFormatter(log_utils.LOG_FORMATTER_NO_FUNC)
DEFAULT_STORAGE_ROOT = Config.get_default().storage_root


Expand Down Expand Up @@ -205,7 +209,7 @@ def entrypoint(cls):
parser_export.add_argument('backup_id', type=int, help='The ID of the backup to export')
parser_export.add_argument('output', help='The output file name of the exported backup. Example: my_backup.tar')
parser_export.add_argument('-f', '--format', help='The format of the output file. If not given, attempt to infer from the output file name. Options: {}'.format(enum_options(StandaloneBackupFormat)))
parser_export.add_argument('--fail-soft', action='store_true', help='Skip files with export failure in the backup, so a single failure will not abort the export')
parser_export.add_argument('--fail-soft', action='store_true', help='Skip files with export failure in the backup, so a single failure will not abort the export. Notes: a corrupted file might damaged the tar-based file ')
parser_export.add_argument('--no-verify', action='store_true', help='Do not verify the exported file contents')

desc = 'Extract a single file from a backup'
Expand Down
1 change: 1 addition & 0 deletions prime_backup/utils/log_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from prime_backup import constants

LOG_FORMATTER = logging.Formatter('[%(asctime)s %(levelname)s] (%(funcName)s) %(message)s')
LOG_FORMATTER_NO_FUNC = logging.Formatter('[%(asctime)s %(levelname)s] %(message)s')


def __get_log_mode() -> int:
Expand Down

0 comments on commit 0e80915

Please sign in to comment.