Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ function _parseVault (options) {
}

function _warn (message) {
console.error(`[dotenv@${version}][WARN] ${message}`)
console.error(`⚠ ${message} · dotenv@${version}`)
}

function _debug (message) {
console.log(`[dotenv@${version}][DEBUG] ${message}`)
console.log(`┆ ${message} · dotenv@${version}`)
}

function _log (message) {
console.log(`[dotenv@${version}] ${message}`)
console.log(`◇ ${message} · dotenv@${version}`)
}
Comment on lines 125 to 135

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new log format uses Unicode glyphs (, , ) and removes the explicit [WARN]/[DEBUG] tokens. That can break downstream tooling that greps for the previous stable prefixes (or for WARN/DEBUG), and Unicode output is still a real-world compatibility issue in some CI/log pipelines and Windows terminals.

Suggestion

Consider preserving a machine-parsable severity token (and/or providing an opt-in/opt-out) while keeping the new UX. For example:

function _warn (message) {
  console.error(`⚠ [WARN] ${message} · dotenv@${version}`)
}
function _debug (message) {
  console.log(`┆ [DEBUG] ${message} · dotenv@${version}`)
}
function _log (message) {
  console.log(`◇ ${message} · dotenv@${version}`)
}

Alternatively, gate the glyphs behind an env var like DOTENV_LOG_FORMAT=pretty|classic and default to classic in non-TTY contexts.

Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this suggestion.


function _dotenvKey (options) {
Expand Down Expand Up @@ -230,7 +230,7 @@ function _configVault (options) {
const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || (options && options.quiet))

if (debug || !quiet) {
_log('Loading env from encrypted .env.vault')
_log('loading env from encrypted .env.vault')
}

const parsed = DotenvModule._parseVault(options)
Expand Down Expand Up @@ -259,7 +259,7 @@ function configDotenv (options) {
encoding = options.encoding
} else {
if (debug) {
_debug('No encoding is specified. UTF-8 is used by default')
_debug('no encoding is specified (UTF-8 is used by default)')
}
}

Expand Down Expand Up @@ -287,7 +287,7 @@ function configDotenv (options) {
DotenvModule.populate(parsedAll, parsed, options)
} catch (e) {
if (debug) {
_debug(`Failed to load ${path} ${e.message}`)
_debug(`failed to load ${path} ${e.message}`)
}
lastError = e
}
Expand All @@ -308,7 +308,7 @@ function configDotenv (options) {
shortPaths.push(relative)
} catch (e) {
if (debug) {
_debug(`Failed to load ${filePath} ${e.message}`)
_debug(`failed to load ${filePath} ${e.message}`)
}
lastError = e
}
Expand All @@ -335,7 +335,7 @@ function config (options) {

// dotenvKey exists but .env.vault file does not exist
if (!vaultPath) {
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`)
_warn(`you set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}`)

return DotenvModule.configDotenv(options)
}
Expand Down
Loading