Skip to content

Commit

Permalink
Rename variable name to command_name.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeZiminski committed Oct 3, 2023
1 parent 99045f7 commit fb2d5f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions datashuttle/datashuttle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ def _get_rclone_config_name(

def _start_log(
self,
name: str,
command_name: str,
local_vars: Optional[dict] = None,
store_in_temp_folder: bool = False,
temp_folder_path: Union[str, Path] = "",
Expand All @@ -1103,8 +1103,7 @@ def _start_log(
Parameters
----------
name : name of the log output files. Typically, the
name of the function logged e.g. "update_config"
command_name : name of the command, for the log output files.
local_vars : local_vars are passed to fancylog variables argument.
see ds_logger.wrap_variables_for_fancylog for more info
Expand Down Expand Up @@ -1135,7 +1134,7 @@ def _start_log(
else:
path_to_save = self.cfg.logging_path

ds_logger.start(path_to_save, name, variables, verbose)
ds_logger.start(path_to_save, command_name, variables, verbose)

def _move_logs_from_temp_folder(self):
"""
Expand Down
10 changes: 5 additions & 5 deletions datashuttle/utils/ds_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@

def start(
path_to_log: Path,
name: str,
command_name: str,
variables: Optional[List[Any]],
verbose: bool = True,
) -> None:
"""
Call fancylog to initialise logging.
"""
filename = get_logging_filename(name)
filename = get_logging_filename(command_name)

fancylog.start_logging(
path_to_log,
Expand All @@ -45,16 +45,16 @@ def start(
write_git=True,
log_to_console=False,
)
logging.info(f"Starting logging for command {name}")
logging.info(f"Starting logging for command {command_name}")


def get_logging_filename(name: str) -> str:
def get_logging_filename(command_name: str) -> str:
"""
Get the filename to which the log will be saved. This
starts with ISO8601-formatted datetime, so logs are stored
in datetime order.
"""
filename = datetime.now().strftime(f"%Y%m%dT%H%M%S_{name}")
filename = datetime.now().strftime(f"%Y%m%dT%H%M%S_{command_name}")
return filename


Expand Down

0 comments on commit fb2d5f7

Please sign in to comment.