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: added console writer for local logging #123

Merged
merged 3 commits into from
Mar 26, 2022
Merged

Conversation

guacamole
Copy link
Member

  • pretty and readable logging for local debugging

@guacamole guacamole requested a review from jay-dee7 March 26, 2022 13:28
@guacamole guacamole self-assigned this Mar 26, 2022
e.Errors = append(e.Errors, err)
}
} else {
_, err = buf.WriteString(color.RedString(" %d", res.Status))
Copy link
Member

Choose a reason for hiding this comment

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

@guacamole can we do yellow for warn and red for error?

Copy link
Member

Choose a reason for hiding this comment

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

also can we please move status up? like right after we calculate log level?

e.Errors = append(e.Errors, err)
}

_, err = buf.WriteString(req.Method + " ")
Copy link
Member

Choose a reason for hiding this comment

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

@guacamole print method field before host

@jay-dee7 jay-dee7 added enhancement New feature or request P2 P2 labels are used for significant features, improvements, etc labels Mar 26, 2022
@jay-dee7 jay-dee7 added this to the Logs and Monitoring milestone Mar 26, 2022
@jay-dee7 jay-dee7 linked an issue Mar 26, 2022 that may be closed by this pull request
l.Output(consoleWriter)
return l
}
zerolog.SetGlobalLevel(zerolog.DebugLevel)
return l
}

Copy link
Member

Choose a reason for hiding this comment

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

@guacamole can we remove this ZerologMiddleware? we don't use it anymore

- this way the handlers don't have to ctx.Set the error key each time and thus removing a bunch of repeated codes
Copy link
Member

@jay-dee7 jay-dee7 left a comment

Choose a reason for hiding this comment

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

@guacamole LGTM 🥇 🥇 🥇

@guacamole guacamole merged commit b67ac6c into master Mar 26, 2022
@guacamole guacamole deleted the pretty-logger branch March 26, 2022 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2 P2 labels are used for significant features, improvements, etc
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Print JSON logs only in debug mode
2 participants