KEMBAR78
Control log ANSI output via boolean `--log-with-ansi` option by joseluisq · Pull Request #543 · static-web-server/static-web-server · GitHub
Skip to content

Conversation

@joseluisq
Copy link
Collaborator

Description

This PR adds support for controlling ANSI escape codes for colors and other text formatting when logging via a new boolean --log-with-ansi CLI option and its equivalent SERVER_LOG_WITH_ANSI env.

No ANSI by default

Note that from now on, SWS will be no-ansi by default. If you want colored log output, then use --log-with-ansi.
For example:

$ static-web-server -p 8788 -d ./public/ -g trace -z --log-with-ansi

Related Issue

Motivation and Context

It resolves #540.

How Has This Been Tested?

Screenshots (if appropriate):

NOTE: ANSI escape codes for colors and other text formatting is
now disabled by default, if wanted then use --log-with-ansi or its
SERVER_LOG_WITH_ANSI env equivalent.

For example:

$ static-web-server -p 8788 -d ./docker/public/ -g trace -z --log-with-ansi
@joseluisq joseluisq added enhancement New feature or request v2 v2 release labels May 17, 2025
@semanticdiff-com
Copy link

semanticdiff-com bot commented May 17, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  docs/content/configuration/environment-variables.md Unsupported file format
  docs/content/features/logging.md Unsupported file format
  src/logger.rs  0% smaller
  src/settings/cli.rs  0% smaller
  src/settings/file.rs  0% smaller
  src/settings/mod.rs  0% smaller

@joseluisq joseluisq added this to the v2.37.0 milestone May 17, 2025
@joseluisq joseluisq changed the title Control log ansi support via boolean --log-with-ansi option Control log ANSI output via boolean --log-with-ansi option May 17, 2025
@joseluisq joseluisq merged commit 0236980 into master May 17, 2025
@joseluisq joseluisq deleted the feat-log-ansi-support branch May 17, 2025 12:39
@joseluisq joseluisq mentioned this pull request May 17, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request v2 v2 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support disabling log colors

1 participant