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

layout_gha for native GitHub Action logging #220

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

thomasp85
Copy link
Contributor

This is an attempt to port the functionality in https://github.com/hadley/gha to logger.

The current setup is "invasive" in the sense that if it detects you are running in gha it will default to using layout_gha and appender_stderr.

Since GHA has fewer log levels than logger, some are getting squashed together silently, but the title will be set to the original log level (except for TRACE since the gha debug logger doesn't accept a title).

GHA allows you to link the log to a specific file and potential location in the file but since I haven't found a great way to reconcile this with what information logger passes along it is currently unused

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@thomasp85
Copy link
Contributor Author

I have yet to add unit tests etc as I wanted to discuss the PR with you first

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@@ -12,22 +12,23 @@ namespaces_reset <- function() {

namespaces_default <- function() {
has_glue <- requireNamespace("glue", quietly = TRUE)
is_running_gha <- isTRUE(Sys.getenv("GITHUB_ACTIONS") == "true") && !needs_stdout()
Copy link
Owner

Choose a reason for hiding this comment

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

I need to think about this one, as I can imagine (and know) folks using logger in GHA writing outside of the GHA logs, although hopefully explicitly setting the layout as well 🤔

Anyway, this is a super cool idea, thank you! I'm traveling/teaching in the next ~48 hours, but I will definitely get back to this PR for a more detailed look on Friday.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I can imagine. Ultimatively it is your call and I understand being weary of messing up peoples current deployment. On the other hand it would be a nice quality-of-life improvement for new projects

Copy link
Contributor Author

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

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

It would be nice to also support the summary log that GHA provides, but there is no existing way of specifying a job summary with logger. Is that something you have thought about, or can you see a good interface for such a functionality (maybe in a way that is broader than GHA)

For context, the GHA summary is created by writing to a separate file whose path is given as an environment variable

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.

None yet

2 participants