diff --git a/src/lib/index.ts b/src/lib/index.ts index f5f5087..fe1270a 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1,5 +1,12 @@ // place files you want to import through the `$lib` alias in this folder. import path from 'path'; +import bunyan from 'bunyan'; + +export const log = bunyan.createLogger({ + name: 'fotochallenge', + level: process.env.NODE_ENV === 'production' ? 'info' : 'debug', + src: true +}); function safePath(basePath: string, name: string): boolean { const fullPath = `${basePath}/${name}`; @@ -17,7 +24,7 @@ function safePath(basePath: string, name: string): boolean { const defaultPath: string = './uploads'; if (!('STORAGE_PATH' in process.env)) { - console.warn(`'STORAGE_PATH' environment variable is not set. Defaulting to ${defaultPath}`); + log.warn(`'STORAGE_PATH' environment variable is not set. Defaulting to ${defaultPath}`); } export const storagePath: string = process.env.STORAGE_PATH ?? defaultPath;