summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/hot-laws-allow.md5
-rw-r--r--packages/astro/src/build.ts4
-rw-r--r--packages/astro/src/dev.ts4
-rw-r--r--packages/astro/src/logger.ts6
-rw-r--r--packages/astro/src/reload.ts4
-rw-r--r--packages/astro/src/snowpack-logger.ts7
6 files changed, 18 insertions, 12 deletions
diff --git a/.changeset/hot-laws-allow.md b/.changeset/hot-laws-allow.md
new file mode 100644
index 000000000..2afb3148d
--- /dev/null
+++ b/.changeset/hot-laws-allow.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fixes logging to default to the info level
diff --git a/packages/astro/src/build.ts b/packages/astro/src/build.ts
index afd0ef5b9..484b9dbec 100644
--- a/packages/astro/src/build.ts
+++ b/packages/astro/src/build.ts
@@ -18,11 +18,11 @@ import { buildCollectionPage, buildStaticPage, getPageType } from './build/page.
import { generateSitemap } from './build/sitemap.js';
import { logURLStats, collectBundleStats, mapBundleStatsToURLStats } from './build/stats.js';
import { getDistPath, stopTimer } from './build/util.js';
-import { debug, defaultLogDestination, error, info, warn, trapWarn } from './logger.js';
+import { debug, defaultLogDestination, defaultLogLevel, error, info, warn, trapWarn } from './logger.js';
import { createRuntime } from './runtime.js';
const defaultLogging: LogOptions = {
- level: 'debug',
+ level: defaultLogLevel,
dest: defaultLogDestination,
};
diff --git a/packages/astro/src/dev.ts b/packages/astro/src/dev.ts
index d040e9cc3..fdebc72cb 100644
--- a/packages/astro/src/dev.ts
+++ b/packages/astro/src/dev.ts
@@ -6,14 +6,14 @@ import { green } from 'kleur/colors';
import http from 'http';
import path from 'path';
import { performance } from 'perf_hooks';
-import { defaultLogDestination, debug, error, info, parseError } from './logger.js';
+import { defaultLogDestination, defaultLogLevel, debug, error, info, parseError } from './logger.js';
import { createRuntime } from './runtime.js';
import { stopTimer } from './build/util';
const hostname = '127.0.0.1';
const logging: LogOptions = {
- level: 'debug',
+ level: defaultLogLevel,
dest: defaultLogDestination,
};
diff --git a/packages/astro/src/logger.ts b/packages/astro/src/logger.ts
index a7531f9a3..f1329eeb1 100644
--- a/packages/astro/src/logger.ts
+++ b/packages/astro/src/logger.ts
@@ -1,6 +1,6 @@
import 'source-map-support/register.js';
import type { CompileError } from '@astrojs/parser';
-import { bold, blue, red, grey, underline } from 'kleur/colors';
+import { bold, blue, red, grey, underline, yellow } from 'kleur/colors';
import { Writable } from 'stream';
import { format as utilFormat } from 'util';
import stringWidth from 'string-width';
@@ -20,6 +20,8 @@ export const defaultLogDestination = new Writable({
if (type !== null) {
if (event.level === 'info') {
type = bold(blue(type));
+ } else if (event.level === 'warn') {
+ type = bold(yellow(type));
} else if (event.level === 'error') {
type = bold(red(type));
}
@@ -166,3 +168,5 @@ function padStr(str: string, len: number) {
const spaces = Array.from({ length: len - strLen }, () => ' ').join('');
return str + spaces;
}
+
+export const defaultLogLevel: LoggerLevel = process.argv.includes('--verbose') ? 'debug' : 'info'; \ No newline at end of file
diff --git a/packages/astro/src/reload.ts b/packages/astro/src/reload.ts
index 71d39ba95..3d635cd51 100644
--- a/packages/astro/src/reload.ts
+++ b/packages/astro/src/reload.ts
@@ -1,9 +1,9 @@
import type { LogOptions } from './logger';
import { clearCache } from 'snowpack';
-import { defaultLogDestination, debug, error, info, parseError } from './logger.js';
+import { defaultLogDestination, defaultLogLevel, info } from './logger.js';
const logging: LogOptions = {
- level: 'debug',
+ level: defaultLogLevel,
dest: defaultLogDestination,
};
diff --git a/packages/astro/src/snowpack-logger.ts b/packages/astro/src/snowpack-logger.ts
index 0d3b98750..0bc791446 100644
--- a/packages/astro/src/snowpack-logger.ts
+++ b/packages/astro/src/snowpack-logger.ts
@@ -1,15 +1,12 @@
import { logger as snowpackLogger } from 'snowpack';
-
-function verboseLogging() {
- return process.argv.includes('--verbose');
-}
+import { defaultLogLevel } from './logger.js';
const onceMessages = ['Ready!', 'watching for file changes'].map((str) => new RegExp(`\\[snowpack\\](.*?)${str}`));
export function configureSnowpackLogger(logger: typeof snowpackLogger) {
const messageCache = new Set<string>();
- if (verboseLogging()) {
+ if (defaultLogLevel === 'debug') {
logger.level = 'debug';
}