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

feat: add new formatter log output for github #59

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

Conversation

fzipi
Copy link
Member

@fzipi fzipi commented Nov 20, 2022

Signed-off-by: Felipe Zipitria [email protected]

Modify logger to output in a format parseable by Github's runners.

Fixes #56.

Pending:

  • add tests on output

@fzipi fzipi force-pushed the add-github-zerolog-output branch 2 times, most recently from c343cf2 to f2418cf Compare February 27, 2024 20:22
chore/update_copyright.go Outdated Show resolved Hide resolved
@fzipi fzipi force-pushed the add-github-zerolog-output branch from 9eaefbd to 9ea579c Compare March 1, 2024 11:58
@fzipi
Copy link
Member Author

fzipi commented Mar 1, 2024

Moved commit 9ea579c to #122.

@fzipi fzipi force-pushed the add-github-zerolog-output branch from 8891875 to 932d12b Compare March 2, 2024 17:43
@fzipi fzipi marked this pull request as ready for review March 2, 2024 17:43
@fzipi fzipi requested a review from theseion March 2, 2024 17:43
@fzipi
Copy link
Member Author

fzipi commented Mar 2, 2024

@theseion Looks like test is failing (cmd/regex_compare_test.go:151) because the error was not triggered per if rootValues.output == gitHub... so probably we want to change the test?

@fzipi fzipi force-pushed the add-github-zerolog-output branch from 932d12b to 58bbb52 Compare March 2, 2024 20:47
Copy link
Collaborator

@theseion theseion left a comment

Choose a reason for hiding this comment

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

❤️

logger/logger_test.go Show resolved Hide resolved
logger/logger_test.go Show resolved Hide resolved
logger/logger_test.go Show resolved Hide resolved
}

func (s *loggerTestSuite) TestConsoleOutput() {
s.logger = s.logger.Output(zerolog.ConsoleWriter{Out: s.out, NoColor: true, TimeFormat: "03:04:05"})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of configuring the console output here explicitly for the test, wouldn't it be better to have an additional choice to generate JSON output? Just like you did now for GH.

Copy link
Member Author

Choose a reason for hiding this comment

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

Did you mean console output? JSON is the default. Do you want something like SetConsoleOutput?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Zerolog's default is JSON, but our global logger is configured to use the console writer. So for users, currently, there's only the option of either console or GH optimised output. I don't see the point in testing JSON output if we don't offer it to users.

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.

Use configurable output, not the logger
2 participants