Skip to content

fix(logger): log file using pretty format not working - #42319

Merged
secustor merged 8 commits into
renovatebot:mainfrom
felipecrs:fix-log-file-pretty
Apr 14, 2026
Merged

fix(logger): log file using pretty format not working#42319
secustor merged 8 commits into
renovatebot:mainfrom
felipecrs:fix-log-file-pretty

Conversation

@felipecrs

@felipecrs felipecrs commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Changes

I tried to use LOG_FILE_FORMAT=pretty today and noticed it wasn't working at all. It was throwing an error at the very beginning of the execution:

> node lib/renovate.ts

 INFO: Renovate started
       "renovateVersion": "0.0.0-semantic-release"
ERROR: unhandledRejection
       "err": {
         "code": "ERR_INVALID_ARG_TYPE",
         "message": "The \"chunk\" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Object",
         "stack": "TypeError: The \"chunk\" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Object\n    at _write (node:internal/streams/writable:480:13)
         ...

This PR:

  1. Fixes the error above
  2. Fixes a TODO comment regarding typing of RenovateStream by rewriting it to Writable
  3. Changes log file behavior when using pretty format to log without colors, since it otherwise makes the log file much harder to read
  4. Implement a custom handle to format multi-line err.stack prettier for better readability (thanks @secustor)
  5. Add tests.

Context

Please select one of the following:

  • This closes an existing Issue, Closes: #
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI-generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests, but ran on a real repository, or
  • Both unit tests + ran on a real repository

The public repository:

Loading
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

regression Issue about a regression bug, or the PR caused it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants