Add better logging functionality

Better logging function with winston. Now all logging functions have been updated

James Peret 7 years ago
parent
commit
e77b06990b
2 changed files with 5 additions and 2 deletions
  1. 4 1
      src/logger.js
  2. 1 1
      src/multi-adapter.coffee

+ 4 - 1
src/logger.js

@@ -1,5 +1,6 @@
1 1
 var winston = require('winston');
2 2
 winston.emitErrs = true;
3
+winston.setLevels(winston.config.syslog.levels);
3 4
 
4 5
 var winstonLog = new winston.Logger({
5 6
     transports: [
@@ -13,7 +14,7 @@ var winstonLog = new winston.Logger({
13 14
             colorize: false
14 15
         }),
15 16
         new winston.transports.Console({
16
-            level: 'info',
17
+            level: 'debug',
17 18
             handleExceptions: true,
18 19
             json: false,
19 20
             colorize: true
@@ -22,6 +23,8 @@ var winstonLog = new winston.Logger({
22 23
     exitOnError: false
23 24
 });
24 25
 
26
+
27
+
25 28
 var log = function(robot, level, msg, data){
26 29
   //console.log("logging data...")
27 30
   winstonLog.log(level, msg, data);

+ 1 - 1
src/multi-adapter.coffee

@@ -10,7 +10,7 @@ app = express()
10 10
 bodyParser = require("body-parser")
11 11
 app.use(bodyParser.urlencoded({ extended: false }))
12 12
 app.use(bodyParser.json());
13
-app.use(require('morgan')({ "stream": logger.stream }));
13
+app.use(require('morgan')("default", { "stream": logger.stream }));
14 14
 
15 15
 http_port = parseInt process.env.HUBOT_HTTP_PORT or 80
16 16
 app.listen http_port, =>