Skip to content

feat: use createCliLogger to read watt.json#203

Open
MzUgM wants to merge 2 commits intomainfrom
feat/wattjson
Open

feat: use createCliLogger to read watt.json#203
MzUgM wants to merge 2 commits intomainfrom
feat/wattjson

Conversation

@MzUgM
Copy link
Copy Markdown

@MzUgM MzUgM commented Mar 27, 2026

Relies on changes in platformatic/platformatic#4688

This allows watt-extra to use the same logging configuration as the watt application that it is running.

One potential gap: when calling the version command, it won't know about the app dir. I think this is ok because:

  1. Why would someone run the version command from outside their project in production?
  2. The start command prints the version and has the context of where the watt.json is located, correctly formatting the logs

Running from root of this project:

> node cli.js version | less

{"level":30,"time":1774583572765,"pid":1882509,"hostname":"jewelthief","msg":"WattExtra v1.11.0"}

Running against a fixture with debug level and ISO timestamp:

> node cli.js start --app-dir test/fixtures/custom-logger | less

{"level":30,"time":"2026-03-27T04:47:35.377Z","pid":1898169,"hostname":"jewelthief","msg":"WattExtra v1.11.0"}
{"level":20,"time":"2026-03-27T04:47:35.377Z","pid":1898169,"hostname":"jewelthief","args":{"_":[],"help":false,"h":false,"app-dir":"test/fixtures/custom-logger","d":"test/fixtures/custom-logger","log-level":"info","l":"info"},"argv":["--app-dir","test/fixtures/custom-logger"],"msg":"Start command arguments"}
{"level":30,"time":"2026-03-27T04:47:35.386Z","pid":1898169,"hostname":"jewelthief","msg":"Environment variables set up"}

To test locally:

  1. Pull the feat/cli-logger-extension branch from platformatic
  2. Do the global linking
  3. Install foundation in the project using the global link
  4. Execute tests

@MzUgM
Copy link
Copy Markdown
Author

MzUgM commented Mar 27, 2026

Test results from local:
test.log

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant