Add the cli flag --silent
to astro which sets astro and snowpack logging to output nothing (#613)
This commit is contained in:
parent
047652295b
commit
42a1fd7c16
4 changed files with 16 additions and 1 deletions
5
.changeset/pretty-windows-bow.md
Normal file
5
.changeset/pretty-windows-bow.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Add command line flag `--silent` to astro to set no output.
|
|
@ -78,6 +78,7 @@ function printHelp() {
|
|||
--no-sitemap Disable sitemap generation (build only).
|
||||
--reload Clean the cache, reinstalling dependencies.
|
||||
--verbose Enable verbose logging
|
||||
--silent Disable logging
|
||||
--version Show the version number and exit.
|
||||
--help Show this help message.
|
||||
`);
|
||||
|
|
|
@ -159,4 +159,11 @@ function padStr(str: string, len: number) {
|
|||
return str + spaces;
|
||||
}
|
||||
|
||||
export const defaultLogLevel: LoggerLevel = process.argv.includes('--verbose') ? 'debug' : 'info';
|
||||
export let defaultLogLevel: LoggerLevel;
|
||||
if (process.argv.includes('--verbose')) {
|
||||
defaultLogLevel = 'debug';
|
||||
} else if (process.argv.includes('--silent')) {
|
||||
defaultLogLevel = 'silent';
|
||||
} else {
|
||||
defaultLogLevel = 'info';
|
||||
}
|
||||
|
|
|
@ -4,5 +4,7 @@ import { defaultLogLevel } from './logger.js';
|
|||
export function configureSnowpackLogger(logger: typeof snowpackLogger) {
|
||||
if (defaultLogLevel === 'debug') {
|
||||
logger.level = 'debug';
|
||||
} else if (defaultLogLevel === 'silent') {
|
||||
logger.level = 'silent';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue