Color Logging
Starting with version 7, Membrane API Gateway supports colored log output in the terminal. This feature uses ANSI escape codes to visually highlight different log levels, making it easier to identify errors and warnings during development and debugging.
Configuration
By default, Membrane attempts to auto-detect if your terminal supports ANSI colors. However, you might want to disable this feature manually.
Environment Variable
Use the MEMBRANE_DISABLE_TERM_COLORS environment variable to control the behavior.
Note the logic: setting this to true turns the colors OFF.
| Value | Effect | Use Case |
|---|---|---|
"true" |
Disable Colors | Recommended for CI/CD pipelines, simple log files, or terminals without ANSI support. |
"false" |
Enable Colors | (Default) Best for local development and interactive debugging. |
Why disable it? (Best Practices)
While colors look great in a terminal, they are represented by special characters (ANSI codes) that can clutter log files.
- CI/CD Pipelines: Tools like Jenkins or GitLab CI might display weird characters like
[32mINFO[0mif they don't render ANSI codes correctly. In this case, setMEMBRANE_DISABLE_TERM_COLORS=true. - Log Parsers: If you are shipping logs to ELK, Splunk, or Graylog, plain text is often easier to parse.