]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/logger.ts
Optimize AP fetch
[github/Chocobozzz/PeerTube.git] / server / helpers / logger.ts
index 4bd00e50345abb597bb94d778d14711071e0ea29..5fe3646c55eaf6a23732c75430ba01278c586678 100644 (file)
@@ -1,5 +1,5 @@
 // Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/
-import { mkdirpSync, stat } from 'fs-extra'
+import { stat } from 'fs-extra'
 import { omit } from 'lodash'
 import { join } from 'path'
 import { format as sqlFormat } from 'sql-formatter'
@@ -10,10 +10,6 @@ import { LOG_FILENAME } from '../initializers/constants'
 
 const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
 
-// Create the directory if it does not exist
-// FIXME: use async
-mkdirpSync(CONFIG.STORAGE.LOG_DIR)
-
 function getLoggerReplacer () {
   const seen = new WeakSet()
 
@@ -123,10 +119,9 @@ function buildLogger (labelSuffix?: string) {
 }
 
 function bunyanLogFactory (level: string) {
-  return function () {
+  return function (...params: any[]) {
     let meta = null
-    let args: any[] = []
-    args.concat(arguments)
+    let args = [].concat(params)
 
     if (arguments[0] instanceof Error) {
       meta = arguments[0].toString()
@@ -143,6 +138,7 @@ function bunyanLogFactory (level: string) {
 }
 
 const bunyanLogger = {
+  level: () => { },
   trace: bunyanLogFactory('debug'),
   debug: bunyanLogFactory('debug'),
   info: bunyanLogFactory('info'),