8000 Accept a special value "null" for LOG_DESTINATION by pbrisbin · Pull Request #55 · freckle/blammo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Accept a special value "null" for LOG_DESTINATION #55

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

Merged
merged 3 commits into from
Aug 28, 2024
Merged

Accept a special value "null" for LOG_DESTINATION #55

merged 3 commits into from
Aug 28, 2024

Conversation

pbrisbin
Copy link
Member

This parses a new value "null" as a LogDestination. On non-Windows
systems, it'll be equivalent to "@/dev/null". On Windows systems,
"@\\.\NUL" (an explicitly-namespaced form for the NUL device1).

Closes #50.

I chose not to investigate the open question about whether or not
LOG_DESTINATION=NUL would already Just Work. I decided it didn't
matter, for two reasons:

  1. While it's likely "specifying NUL" may conceptually work, it's very
    possible you still need to practically use LOG_DESTINATION=\\.\NUL
    to do it.

    That would not be very discoverable and the escaping required would
    be quite error-prone, making the null sugar valuable.

  2. Mixed-OS teams attempting to have null as a default in (e.g.) .env
    can't do so today.

    Without this sugar, such teams would have to concretely pick
    /dev/null or NUL.

Together, this seemed like enough to warrant the small bit of alias
complexity.

Footnotes

  1. https://stackoverflow.com/a/58177337

This parses a new value `"null"` as a `LogDestination`. On non-Windows
systems, it'll be equivalent to `"@/dev/null"`. On Windows systems,
`"@\\.\NUL"` (an explicitly-namespaced form for the `NUL` device[^1]).

Closes #50.

I chose not to investigate the open question about whether or not
`LOG_DESTINATION=NUL` would already Just Work. I decided it didn't
matter, for two reasons:

1. While it's likely "specifying `NUL`" may conceptually work, it's very
   possible you still need to practically use `LOG_DESTINATION=\\.\NUL`
   to do it.

   That would not be very discoverable and the escaping required would
   be quite error-prone, making the `null` sugar valuable.

2. Mixed-OS teams attempting to have null as a default in (e.g.) `.env`
   can't do so today.

   Without this sugar, such teams would have to concretely pick
   `/dev/null` or `NUL`.

Together, this seemed like enough to warrant the small bit of alias
complexity.

[^1]: https://stackoverflow.com/a/58177337
@pbrisbin pbrisbin requested a review from chris-martin August 26, 2024 20:17
@pbrisbin pbrisbin marked this pull request as ready for review August 26, 2024 20:17
@pbrisbin pbrisbin enabled auto-merge (rebase) August 28, 2024 16:33
@pbrisbin pbrisbin merged commit 72b73ae into main Aug 28, 2024
8 checks passed
@pbrisbin pbrisbin deleted the pb/null branch August 28, 2024 16:38
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.

Allow a "null" log destination
2 participants
0