Skip to content

Added log file to isofit run cli#733

Merged
pgbrodrick merged 2 commits into
isofit:devfrom
evan-greenbrg:logging/isofit_run_logfile
Jul 17, 2025
Merged

Added log file to isofit run cli#733
pgbrodrick merged 2 commits into
isofit:devfrom
evan-greenbrg:logging/isofit_run_logfile

Conversation

@evan-greenbrg

@evan-greenbrg evan-greenbrg commented Jul 16, 2025

Copy link
Copy Markdown
Collaborator

I had the need for log files from the isofit run cli while testing the wavelength calibration. Figured I roll into a PR.

@evan-greenbrg evan-greenbrg requested a review from jammont July 16, 2025 22:10
@pgbrodrick

Copy link
Copy Markdown
Collaborator

Thanks Evan, this is a nobrainer for me...while you're in here, want to hook up an option for the log level too?

Once checks pass, looks good.

@evan-greenbrg

Copy link
Copy Markdown
Collaborator Author

@pgbrodrick I'm pretty sure it has the log level already, just not the file. I haven't tested to double check that the log level is working properly however.

@pgbrodrick

Copy link
Copy Markdown
Collaborator

Yup, you're right, I didn't scroll up on the diff - looks like it's all connected.

@jammont jammont left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good! Thanks for implementing some missing functionality. Good to know this command is even used 👍

Comment thread isofit/core/isofit.py Outdated
default="INFO",
)
def cli(config_file, level):
@click.option("--log_file", default=None)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

default=None is redundant as that's already the default

Comment thread isofit/core/isofit.py Outdated

logging.basicConfig(format="%(message)s", level=level)
Isofit(config_file=config_file, level=level).run()
logging.basicConfig(format="%(message)s", filename=log_file, level=level)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I know you didn't add this line, but the Isofit class also calls logging.basicConfig, maybe we should simplify and just remove this line? Can't think of a reason this one would be needed, and the only difference is Isofit's include additional formatting.

Just to note, logging.basicConfig ignores any subsequent calls, so this one takes priority.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Perfect, thanks for clarifying!

@pgbrodrick pgbrodrick merged commit 0cead65 into isofit:dev Jul 17, 2025
17 checks passed
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.

3 participants