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

docs: how to disable status code coloring in logger middleware #553

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/middleware/builtin/logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ By using the Logger Middleware, you can easily monitor the flow of requests and

You can also extend the middleware further by providing your own `PrintFunc` function for tailored logging behavior.

::: tip

To disable _status code coloring_, you can set a `NO_COLOR` environment variable. This is a common way to disable ANSI color escape codes in logging libraries, and is described at <https://no-color.org/>. Note that CloudFlare Workers do not have a `process.env` object, so will default to plaintext log output.
Copy link
Member

Choose a reason for hiding this comment

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

CloudFlare Workers should be Cloudflare Workers (f is lowercase).

:::

## PrintFunc

The Logger Middleware accepts an optional `PrintFunc` function as a parameter. This function allows you to customize the logger and add additional logs.
Expand Down
1 change: 1 addition & 0 deletions docs/middleware/third-party.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ Most of this middleware leverages external libraries.
- [Geo](https://github.com/ktkongtong/hono-geo-middleware/tree/main/packages/middleware)
- [Hono Simple DI](https://github.com/maou-shonen/hono-simple-DI)
- [Highlight.io](https://www.highlight.io/docs/getting-started/backend-sdk/js/hono)
- [Pino logger](https://github.com/maou-shonen/hono-pino)