Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a separate log file for each run of hlink #55

Merged
merged 2 commits into from
Nov 28, 2022
Merged

Conversation

riley-harper
Copy link
Contributor

Closes #54.

This PR updates hlink's main script to log to a separate file for each run instead of always logging to the same file. The name of the log file is {conf_name}-{session_id}.log, where session_id is the hexadecimal representation of a uuid generated for the run. Each log file is placed in the same directory, named logs/. The location of this logs/ directory depends on whether a global configuration file is provided with the HLINK_CONF environment variable or not.

This changes main.load_conf() so that it adds the key "log_dir" to the config dictionary instead of "log_file". This isn't a big deal, as the only other place that uses these keys is main._setup_logging().

… a "log_file" attribute

This lets us decide what to name the log file later in main._setup_logging(). This will
be helpful when we want to change the name of the log for each hlink run.

This also slightly changes the current logging setup. It creates a logs/ subdirectory
and outputs logs to an hlink.log file in that subdirectory.
The name of the file is {conf_name}-{session_id}, where session_id is the hexadecimal
representation of a uuid for the run.

I also changed the log header because now there's one per file and we don't need to block
it off from the surrounding text as much.
Copy link
Collaborator

@jacwellington jacwellington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me, thanks!

@riley-harper riley-harper merged commit 5f6d564 into main Nov 28, 2022
@riley-harper riley-harper deleted the separate_logs branch November 28, 2022 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log to a separate file for each hlink run
2 participants