Commit 0b6272e09aba091c99777431b4ce6b0c65ca09b9
1 parent
e57c30ae
Exists in
master
update template
Showing
24 changed files
with
1266 additions
and
1079 deletions
Show diff stats
app.config.json
1 | 1 | { |
2 | 2 | "default": { |
3 | - "appName": "Hostpital service", | |
3 | + "appName": "Hostpital", | |
4 | 4 | "appPort": 3000, |
5 | 5 | "apiUrlPrefix": "/api", |
6 | 6 | "requestTimeout": 10, |
7 | 7 | "mongoDB" : { |
8 | 8 | "hopitalIp" : "10.1.2.155:27017", |
9 | - "hopitalName" : "spw" | |
10 | - } | |
9 | + "hopitalName" : "hospital" | |
10 | + }, | |
11 | + "configlog" : { | |
12 | + "log" : { | |
13 | + "time" : 15, | |
14 | + "size" : null, | |
15 | + "path" : "./logs/log", | |
16 | + "level" : "debug", | |
17 | + "console" : false, | |
18 | + "file" : true | |
19 | + }, | |
20 | + "summary" : { | |
21 | + "time" : 15, | |
22 | + "size" : null, | |
23 | + "path" : "./logs/summary", | |
24 | + "console" : false, | |
25 | + "file" : true | |
26 | + }, | |
27 | + "detail" : { | |
28 | + "time" : 15, | |
29 | + "size" : null, | |
30 | + "path" : "./logs/detail", | |
31 | + "console" : false, | |
32 | + "file" : true | |
33 | + }, | |
34 | + "stat" : { | |
35 | + "time" : 15, | |
36 | + "size" : null, | |
37 | + "path" : "./logs/stat", | |
38 | + "mode" : 0, | |
39 | + "pathDB" : "undefined", | |
40 | + "statInterval" : 15, | |
41 | + "console" : false, | |
42 | + "file" : true | |
43 | + } | |
44 | + } | |
45 | + | |
11 | 46 | |
12 | 47 | |
13 | 48 | ... | ... |
app.js
... | ... | @@ -3,6 +3,10 @@ const express = require('express'); |
3 | 3 | const app = express(); |
4 | 4 | const conf = require('utils/config'); |
5 | 5 | const utils = require('utils/utils'); |
6 | +var log = require('./utils/log'); | |
7 | + | |
8 | +var logg = require('commonlog-kb').init(conf.get("configlog"),app); | |
9 | + | |
6 | 10 | |
7 | 11 | // console.log(conf.get('redis.host')); |
8 | 12 | |
... | ... | @@ -10,6 +14,8 @@ const utils = require('utils/utils'); |
10 | 14 | const addRequestId = require('express-request-id')(); |
11 | 15 | app.use(addRequestId); |
12 | 16 | |
17 | + | |
18 | + | |
13 | 19 | // setup express-session with redis store |
14 | 20 | const session = require('express-session'); |
15 | 21 | // const RedisStore = require('connect-redis')(session); |
... | ... | @@ -31,6 +37,46 @@ const uuidV4 = require('uuid/v4'); |
31 | 37 | // })); |
32 | 38 | |
33 | 39 | |
40 | + | |
41 | +function logResponseBody(req, res, next) { | |
42 | + var oldWrite = res.write, | |
43 | + oldEnd = res.end; | |
44 | + | |
45 | + var chunks = []; | |
46 | + | |
47 | + res.write = function (chunk) { | |
48 | + chunks.push(chunk); | |
49 | + oldWrite.apply(res, arguments); | |
50 | + }; | |
51 | + | |
52 | + res.end = function (chunk) { | |
53 | + var body = ''; | |
54 | + | |
55 | + if (typeof chunk !== 'string' && !(chunk instanceof Buffer)) { | |
56 | + res["resBody"] = body ; | |
57 | + oldEnd.apply(res, arguments); | |
58 | + return ; | |
59 | + } | |
60 | + | |
61 | + if (!(chunk instanceof String || typeof chunk === 'string' ) ) | |
62 | + chunks.push(chunk); | |
63 | + try { | |
64 | + //console.dir(chunks); | |
65 | + body = chunks.length > 0? Buffer.concat(chunks).toString('utf8') :''; | |
66 | + } catch (error) { | |
67 | + logger.errorStack(error); | |
68 | + } | |
69 | + | |
70 | + res["resBody"] = body ; | |
71 | + | |
72 | + oldEnd.apply(res, arguments); | |
73 | + }; | |
74 | + | |
75 | + next(); | |
76 | + } | |
77 | + | |
78 | +app.use(logResponseBody); | |
79 | + | |
34 | 80 | // setup json body parser |
35 | 81 | const bodyParser = require('body-parser'); |
36 | 82 | app.use(bodyParser.json()); |
... | ... | @@ -39,8 +85,8 @@ app.use(bodyParser.json()); |
39 | 85 | // const logger = require('utils/request-logger'); |
40 | 86 | |
41 | 87 | // setup express request/response logger |
42 | -const log4js = require('log4js'); | |
43 | -log4js.configure('./config/log4js_config.json'); | |
88 | +// const log4js = require('log4js'); | |
89 | +// log4js.configure('./config/log4js_config.json'); | |
44 | 90 | // const log4jsLogger = log4js.getLogger('express-project'); |
45 | 91 | |
46 | 92 | // const fileTransport = logger.fileTransport; |
... | ... | @@ -88,11 +134,17 @@ app.use(function (req, res, next) { |
88 | 134 | }); |
89 | 135 | |
90 | 136 | |
91 | -app.use( function( req, res, next ) { | |
137 | +app.use(function( req, res, next ) { | |
138 | + if(req.headers["x-user"] && req.headers["usertoken"]) | |
139 | + next(); | |
140 | + else | |
141 | + res.status(401).json({resultCode:40100,resultDescription:'Access denied'}); | |
142 | + | |
143 | + }); | |
92 | 144 | |
145 | +app.use( function( req, res, next ) { | |
146 | + // log.startEC(req); | |
93 | 147 | req = utils.findQueryString(req); |
94 | - | |
95 | - | |
96 | 148 | next(); |
97 | 149 | }); |
98 | 150 | |
... | ... | @@ -111,18 +163,40 @@ app.use(apiUrlPrefix+'/preference', preference); |
111 | 163 | // let apiLogin = require('./controllers/login/login')(passport); |
112 | 164 | // app.use('/', apiLogin); |
113 | 165 | |
114 | - | |
166 | +app.use( function( req, res, next ) { | |
167 | + if(req.res.resBody) | |
168 | + { | |
169 | + try{ | |
170 | + log.logSummary(req,JSON.parse(req.res.resBody)); | |
171 | + } catch(err) { | |
172 | + log.logSummary(req,req.res.resBody); | |
173 | + } | |
174 | + | |
175 | + }else | |
176 | + { | |
177 | + // var response = responseMsg.unknow(req); | |
178 | + | |
179 | + // log.startlog(req,req.method+"_"+"Unknow","Unknow","Unknow"); | |
180 | + // log.logDetail.addInput(req,"Unknow",req.method+"_"+"Unknow","Request",req,req.body); | |
181 | + // log.logDetail.addOutput(req,"Unknow",req.method+"_"+"Unknow","Response",response,response); | |
182 | + | |
183 | + // log.addErrorSummary(req,req.body.clientName,req.method+"_"+"Unknow","null","Unknown URL"); | |
184 | + // res.status(200).json(response); | |
185 | + // log.logSummary(req,response); | |
186 | + } | |
187 | + | |
188 | + // log.endEC(req,res); | |
189 | + next(); | |
190 | +} ); | |
115 | 191 | |
116 | 192 | // handle not found |
117 | -app.all('*', function(req, res) { | |
118 | - res.status(404); | |
193 | +// app.all('*', function(req, res) { | |
119 | 194 | |
120 | - // respond with json | |
121 | - res.send({ | |
122 | - error: 'Not found' | |
123 | - }); | |
195 | +// var response = {resultCode: 40400,resultDescription: 'Data not found'}; | |
196 | +// log.endEC(req,response); | |
197 | +// res.status(404).send(response); | |
124 | 198 | |
125 | -}); | |
199 | +// }); | |
126 | 200 | |
127 | 201 | // // handle errors |
128 | 202 | // app.use(function (err, req, res, next) { | ... | ... |
config/log4js_config.json
... | ... | @@ -1,18 +0,0 @@ |
1 | -{ | |
2 | - "appenders": { | |
3 | - "express-project": { | |
4 | - "type": "dateFile", | |
5 | - "filename": "./logs/express-project", | |
6 | - "pattern": "-yyyyMMdd.log", | |
7 | - "alwaysIncludePattern": false | |
8 | - } | |
9 | - }, | |
10 | - "categories": { | |
11 | - "default": { | |
12 | - "appenders": [ | |
13 | - "express-project" | |
14 | - ], | |
15 | - "level": "all" | |
16 | - } | |
17 | - } | |
18 | -} | |
19 | 0 | \ No newline at end of file |
controllers/preference/index.js
... | ... | @@ -2,33 +2,56 @@ let express = require('express'); |
2 | 2 | let router = express.Router(); |
3 | 3 | let connection = require("../../utils/mongoDB") |
4 | 4 | var utils = require('../../utils/utils'); |
5 | +var stats = require('../../utils/stats'); | |
6 | +var log = require('../../utils/log'); | |
5 | 7 | |
6 | 8 | |
7 | -router.get('/:collection',async function (req, res) { | |
9 | + | |
10 | +router.get('/:collection',async function (req, res,next) | |
11 | +{ | |
12 | + start(req) | |
13 | + var collection = req.params.collection; | |
14 | + | |
8 | 15 | var query = Object.assign(req.params, req.query); |
9 | 16 | var filter = await utils.getQueryFilter(query.filter); |
10 | - var result = await connection.reqMongo(req,req.method,filter,req.params.collection) | |
11 | - res.status(200).json(result); | |
17 | + var result = await connection.reqMongo(req,req.method,filter,collection) | |
12 | 18 | |
13 | - | |
14 | -}); | |
15 | - | |
16 | -router.post('/:collection',async function (req, res) { | |
17 | - var query = Object.assign(req.params, req.query); | |
18 | - var result = await connection.reqMongo(req, query) | |
19 | + end(req); | |
19 | 20 | res.status(200).json(result); |
21 | + next(); | |
20 | 22 | }); |
21 | 23 | |
22 | -router.put('/:collection',async function (req, res) { | |
23 | - var query = Object.assign(req.params, req.query); | |
24 | - var result = await connection.reqMongo(req, query) | |
25 | - res.status(200).json(result); | |
26 | -}); | |
24 | +router.post('/:collection',async function (req, res,next) { | |
25 | + var collection = req.params.collection; | |
27 | 26 | |
28 | -router.delete('/:collection',async function (req, res) { | |
29 | - var query = Object.assign(req.params, req.query); | |
30 | - var result = await connection.reqMongo(req, query) | |
27 | + var query = req.body; | |
28 | + var result = await connection.reqMongo(req,req.method,query,collection) | |
31 | 29 | res.status(200).json(result); |
30 | + next(); | |
32 | 31 | }); |
33 | 32 | |
33 | +// router.put('/:collection',async function (req, res) { | |
34 | +// var query = Object.assign(req.params, req.query); | |
35 | +// var result = await connection.reqMongo(req, query) | |
36 | +// res.status(200).json(result); | |
37 | +// }); | |
38 | + | |
39 | +// router.delete('/:collection',async function (req, res) { | |
40 | +// var query = Object.assign(req.params, req.query); | |
41 | +// var result = await connection.reqMongo(req, query) | |
42 | +// res.status(200).json(result); | |
43 | +// }); | |
44 | + | |
45 | +function start(req) { | |
46 | + var cmd = req.params.collection; | |
47 | + log.startlog(req,cmd,'session','identity'); | |
48 | + stats.receiveRequest(req.method,cmd); | |
49 | + log.detailRequestFE(req); | |
50 | +}; | |
51 | + | |
52 | +function end(req) { | |
53 | + var collection = req.params.collection; | |
54 | + stats.sendResponse(req.method,collection); | |
55 | + log.detailResponseFE(req); | |
56 | +}; | |
34 | 57 | module.exports = router; |
35 | 58 | \ No newline at end of file | ... | ... |
logs/app.log
1 | -{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
2 | -{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
3 | -{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: \"[{\\\"table\\\":\\\"get_spwHashtags\\\",\\\"value\\\":\\\"bbb\\\"}]\"","level":"info"} | |
4 | -{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
5 | -{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
6 | -{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
7 | -{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
8 | -{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
9 | -{"message":"phoenix-partner - :: ## - - ## BE Receive SQL Result: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
10 | -{"message":"phoenix-partner - :: ## - - ## BE Receive SQL Result: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
11 | -{"message":"phoenix-partner - :: ## - session - 001bed68-f6d3-4b43-b955-5178249d3e81 ## BE Receive SQL Result: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
12 | -{"message":"phoenix-partner - :: ## - session - a78f627a-aef2-477a-ac52-d144167170f1 ## BE Receive SQL Result: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
13 | -{"message":"phoenix-partner - :: ## - session - 85a0f68c-6543-4db9-9bb3-8f25a6597cb0 ## BE Send SQL Query: {\"table\":\"get_spwHashtags\"}","level":"info"} | |
14 | -{"message":"phoenix-partner - :: ## - session - 85a0f68c-6543-4db9-9bb3-8f25a6597cb0 ## BE Receive SQL Result: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
15 | -{"message":"phoenix-partner - :: ## - session - 24b3d4de-356c-4bd4-a07b-c419a0466f57 ## BE Send SQL Query: {\"collection\":\"general\",\"filter\":\"(&(companyName=เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ))\",\"fields\":\"companyName\"}","level":"info"} | |
16 | -{"message":"phoenix-partner - :: ## - session - 24b3d4de-356c-4bd4-a07b-c419a0466f57 ## BE Receive SQL Result: []","level":"info"} | |
17 | -{"message":"phoenix-partner - :: ## - session - 3a1fad66-0e0f-4499-848e-ac5dae13ba7f ## BE Send SQL Query: {\"companyName\":{}}","level":"info"} | |
18 | -{"message":"phoenix-partner - :: ## - session - 3a1fad66-0e0f-4499-848e-ac5dae13ba7f ## BE Receive SQL Result: []","level":"info"} | |
19 | -{"message":"phoenix-partner - :: ## - session - 330610bf-2f1f-4f45-a7b5-5a4d686eab52 ## BE Send SQL Query: {\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}","level":"info"} | |
20 | -{"message":"phoenix-partner - :: ## - session - 330610bf-2f1f-4f45-a7b5-5a4d686eab52 ## BE Receive SQL Result: []","level":"info"} | |
1 | +{"message":"phoenix-partner - :: ## - session - 04d98ad6-9059-4da1-bbbf-d7303d09dd2e ## BE Send SQL Query: {}","level":"info"} | |
2 | +{"message":"phoenix-partner - :: ## - session - 04d98ad6-9059-4da1-bbbf-d7303d09dd2e ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
3 | +{"message":"phoenix-partner - :: ## - session - 1780404a-077a-4b70-a8c1-1b7d0571923c ## BE Send SQL Query: {}","level":"info"} | |
4 | +{"message":"phoenix-partner - :: ## - session - 1780404a-077a-4b70-a8c1-1b7d0571923c ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
5 | +{"message":"phoenix-partner - :: ## - session - 8f655908-8aa4-4725-9d62-55ba2ea9d1ab ## BE Send SQL Query: {}","level":"info"} | |
6 | +{"message":"phoenix-partner - :: ## - session - 8f655908-8aa4-4725-9d62-55ba2ea9d1ab ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
7 | +{"message":"phoenix-partner - :: ## - session - 506859e0-4b65-4f0f-a412-4d46cc19e5f5 ## BE Send SQL Query: {}","level":"info"} | |
8 | +{"message":"phoenix-partner - :: ## - session - 7329ea83-69f1-404b-9e2c-26d12ac387ba ## BE Send SQL Query: {}","level":"info"} | |
9 | +{"message":"phoenix-partner - :: ## - session - 7329ea83-69f1-404b-9e2c-26d12ac387ba ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
10 | +{"message":"phoenix-partner - :: ## - session - df2b4246-948b-49fd-8a2e-68d5eb2fc341 ## BE Send SQL Query: {}","level":"info"} | |
11 | +{"message":"phoenix-partner - :: ## - session - df2b4246-948b-49fd-8a2e-68d5eb2fc341 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
12 | +{"message":"phoenix-partner - :: ## - session - c01c884a-0974-4ffe-ae15-4e718d22102c ## BE Send SQL Query: {}","level":"info"} | |
13 | +{"message":"phoenix-partner - :: ## - session - c01c884a-0974-4ffe-ae15-4e718d22102c ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
14 | +{"message":"phoenix-partner - :: ## - session - 6b72cc36-0b98-4748-bd94-24a2cb61f8fa ## BE Send SQL Query: {}","level":"info"} | |
15 | +{"message":"phoenix-partner - :: ## - session - 6b72cc36-0b98-4748-bd94-24a2cb61f8fa ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
16 | +{"message":"phoenix-partner - :: ## - session - b0ba16a9-bd43-43c6-b15d-b8a028186ee6 ## BE Send SQL Query: {}","level":"info"} | |
17 | +{"message":"phoenix-partner - :: ## - session - b0ba16a9-bd43-43c6-b15d-b8a028186ee6 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
18 | +{"message":"phoenix-partner - :: ## - session - b70a2d8a-7773-4f38-9fde-dc3be93846ea ## BE Send SQL Query: {}","level":"info"} | |
19 | +{"message":"phoenix-partner - :: ## - session - b70a2d8a-7773-4f38-9fde-dc3be93846ea ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
20 | +{"message":"phoenix-partner - :: ## - session - d630c3ee-495d-4708-8332-b98b2f0be3d2 ## BE Send SQL Query: {}","level":"info"} | |
21 | +{"message":"phoenix-partner - :: ## - session - d630c3ee-495d-4708-8332-b98b2f0be3d2 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
22 | +{"message":"phoenix-partner - :: ## - session - 02df435b-e197-4db8-9d53-3847d9ed5169 ## BE Send SQL Query: {}","level":"info"} | |
23 | +{"message":"phoenix-partner - :: ## - session - 02df435b-e197-4db8-9d53-3847d9ed5169 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
24 | +{"message":"phoenix-partner - :: ## - session - 823a373e-c3dd-4bd5-b623-48361a952bd0 ## BE Send SQL Query: {}","level":"info"} | |
25 | +{"message":"phoenix-partner - :: ## - session - 823a373e-c3dd-4bd5-b623-48361a952bd0 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
26 | +{"message":"phoenix-partner - :: ## - session - d48011c1-f2b3-40bb-9090-18ef6c0f5b7e ## BE Send SQL Query: {}","level":"info"} | |
27 | +{"message":"phoenix-partner - :: ## - session - d48011c1-f2b3-40bb-9090-18ef6c0f5b7e ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
28 | +{"message":"phoenix-partner - :: ## - session - 71840e4c-231d-41dc-9d43-50a88b611980 ## BE Send SQL Query: {}","level":"info"} | |
29 | +{"message":"phoenix-partner - :: ## - session - 71840e4c-231d-41dc-9d43-50a88b611980 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
30 | +{"message":"phoenix-partner - :: ## - session - a7a3a04c-df6e-4515-b851-c7c5282ee3b3 ## BE Send SQL Query: {}","level":"info"} | |
31 | +{"message":"phoenix-partner - :: ## - session - a7a3a04c-df6e-4515-b851-c7c5282ee3b3 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
32 | +{"message":"phoenix-partner - :: ## - session - 23601cfc-b4d3-4b19-afcd-57c78820b83a ## BE Send SQL Query: {}","level":"info"} | |
33 | +{"message":"phoenix-partner - :: ## - session - 23601cfc-b4d3-4b19-afcd-57c78820b83a ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
34 | +{"message":"phoenix-partner - :: ## - session - c6efa713-d937-4cad-af8f-ad312a621bbc ## BE Send SQL Query: {}","level":"info"} | |
35 | +{"message":"phoenix-partner - :: ## - session - c6efa713-d937-4cad-af8f-ad312a621bbc ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
36 | +{"message":"phoenix-partner - :: ## - session - a753c21e-8e1d-47d9-8e95-a55d5bdad3c5 ## BE Send SQL Query: {}","level":"info"} | |
37 | +{"message":"phoenix-partner - :: ## - session - a753c21e-8e1d-47d9-8e95-a55d5bdad3c5 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
38 | +{"message":"phoenix-partner - :: ## - session - 594f180c-7bbc-40be-979b-f96098dda0eb ## BE Send SQL Query: {}","level":"info"} | |
39 | +{"message":"phoenix-partner - :: ## - session - 594f180c-7bbc-40be-979b-f96098dda0eb ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
40 | +{"message":"phoenix-partner - :: ## - session - fa98e57d-e0cf-4586-8b1e-751776699864 ## BE Send SQL Query: {}","level":"info"} | |
41 | +{"message":"phoenix-partner - :: ## - session - fa98e57d-e0cf-4586-8b1e-751776699864 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
42 | +{"message":"phoenix-partner - :: ## - session - 12c6a016-ab6f-4c85-ba10-f45e1c3225f4 ## BE Send SQL Query: {}","level":"info"} | |
43 | +{"message":"phoenix-partner - :: ## - session - 12c6a016-ab6f-4c85-ba10-f45e1c3225f4 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
44 | +{"message":"phoenix-partner - :: ## - session - 1a1e9e3f-70ca-47db-aaeb-f1fd604fa418 ## BE Send SQL Query: {}","level":"info"} | |
45 | +{"message":"phoenix-partner - :: ## - session - 1a1e9e3f-70ca-47db-aaeb-f1fd604fa418 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
46 | +{"message":"phoenix-partner - :: ## - session - d00c1de0-0efc-4972-826c-d474aa03d1a8 ## BE Send SQL Query: {}","level":"info"} | |
47 | +{"message":"phoenix-partner - :: ## - session - d00c1de0-0efc-4972-826c-d474aa03d1a8 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
48 | +{"message":"phoenix-partner - :: ## - session - 7d6f045c-9556-4b80-9084-9c5c6991c730 ## BE Send SQL Query: {}","level":"info"} | |
49 | +{"message":"phoenix-partner - :: ## - session - 7d6f045c-9556-4b80-9084-9c5c6991c730 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
50 | +{"message":"phoenix-partner - :: ## - session - 60be9925-ae7a-4e2f-ac64-53a04444f9d1 ## BE Send SQL Query: {}","level":"info"} | |
51 | +{"message":"phoenix-partner - :: ## - session - 60be9925-ae7a-4e2f-ac64-53a04444f9d1 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
52 | +{"message":"phoenix-partner - :: ## - session - ac1f92c2-e419-4015-aeb7-7a4ca0b50e3b ## BE Send SQL Query: {}","level":"info"} | |
53 | +{"message":"phoenix-partner - :: ## - session - ac1f92c2-e419-4015-aeb7-7a4ca0b50e3b ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
54 | +{"message":"phoenix-partner - :: ## - session - 19e0b589-3830-4312-b217-bd6aeb4d98fd ## BE Send SQL Query: {}","level":"info"} | |
55 | +{"message":"phoenix-partner - :: ## - session - 19e0b589-3830-4312-b217-bd6aeb4d98fd ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
56 | +{"message":"phoenix-partner - :: ## - session - 5dfae968-dc62-45dc-810c-de7760786cfd ## BE Send SQL Query: {}","level":"info"} | |
57 | +{"message":"phoenix-partner - :: ## - session - 5dfae968-dc62-45dc-810c-de7760786cfd ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
58 | +{"message":"phoenix-partner - :: ## - session - f7b5c420-8948-4c44-801e-f692503a89c8 ## BE Send SQL Query: {}","level":"info"} | |
59 | +{"message":"phoenix-partner - :: ## - session - f7b5c420-8948-4c44-801e-f692503a89c8 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
60 | +{"message":"phoenix-partner - :: ## - session - f48ff59b-e4e2-413a-8a2f-5c164017277b ## BE Send SQL Query: {}","level":"info"} | |
61 | +{"message":"phoenix-partner - :: ## - session - f48ff59b-e4e2-413a-8a2f-5c164017277b ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
62 | +{"message":"phoenix-partner - :: ## - session - cd1a1dd2-b3bf-4613-81ba-20a54a71509d ## BE Send SQL Query: {}","level":"info"} | |
63 | +{"message":"phoenix-partner - :: ## - session - cd1a1dd2-b3bf-4613-81ba-20a54a71509d ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
64 | +{"message":"phoenix-partner - :: ## - session - 72d831a2-f27d-4ba6-96eb-df88ff72b2a6 ## BE Send SQL Query: {}","level":"info"} | |
65 | +{"message":"phoenix-partner - :: ## - session - 72d831a2-f27d-4ba6-96eb-df88ff72b2a6 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
66 | +{"message":"phoenix-partner - :: ## - session - ecbdab24-bd90-4d98-9864-51460f488c6a ## BE Send SQL Query: {}","level":"info"} | |
67 | +{"message":"phoenix-partner - :: ## - session - ecbdab24-bd90-4d98-9864-51460f488c6a ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
68 | +{"message":"phoenix-partner - :: ## - session - 2cb96fa4-8d9e-4014-868d-40f52a94a6b3 ## BE Send SQL Query: {}","level":"info"} | |
69 | +{"message":"phoenix-partner - :: ## - session - 2cb96fa4-8d9e-4014-868d-40f52a94a6b3 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
70 | +{"message":"phoenix-partner - :: ## - session - a34107f5-9985-4057-afdf-80b0c3a556ce ## BE Send SQL Query: {}","level":"info"} | |
71 | +{"message":"phoenix-partner - :: ## - session - a34107f5-9985-4057-afdf-80b0c3a556ce ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
72 | +{"message":"phoenix-partner - :: ## - session - cb93ee52-410c-4fcc-9705-40a15ff27589 ## BE Send SQL Query: {}","level":"info"} | |
73 | +{"message":"phoenix-partner - :: ## - session - cb93ee52-410c-4fcc-9705-40a15ff27589 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
74 | +{"message":"phoenix-partner - :: ## - session - 40677992-5b74-4dea-aa23-bc00960e6c8f ## BE Send SQL Query: {}","level":"info"} | |
75 | +{"message":"phoenix-partner - :: ## - session - 40677992-5b74-4dea-aa23-bc00960e6c8f ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
76 | +{"message":"phoenix-partner - :: ## - session - 74f770f3-fa62-42fc-9928-f38eb1bb7c7a ## BE Send SQL Query: {}","level":"info"} | |
77 | +{"message":"phoenix-partner - :: ## - session - 74f770f3-fa62-42fc-9928-f38eb1bb7c7a ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
78 | +{"message":"phoenix-partner - :: ## - session - a546d09f-50ae-4aa6-867c-f5218a5c8ac3 ## BE Send SQL Query: {}","level":"info"} | |
79 | +{"message":"phoenix-partner - :: ## - session - a546d09f-50ae-4aa6-867c-f5218a5c8ac3 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | |
80 | +{"message":"phoenix-partner - :: ## - session - 4b3918ad-4407-4bb2-a213-a0da612da513 ## BE Send SQL Query: {}","level":"info"} | |
81 | +{"message":"phoenix-partner - :: ## - session - 4b3918ad-4407-4bb2-a213-a0da612da513 ## BE Receive SQL Result: [{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"},{\"companyName\":\"เนเธฃเธเธเธขเธฒเธเธฒเธฅเนเธเธฒเนเธฅ เธเธซเธฅเนเธขเธเธดเธ\"}]","level":"info"} | ... | ... |
logs/express-project
node_modules/log4js/package.json
1 | 1 | { |
2 | - "_from": "log4js@^3.0.4", | |
2 | + "_from": "log4js@^3.0.6", | |
3 | 3 | "_id": "log4js@3.0.6", |
4 | 4 | "_inBundle": false, |
5 | 5 | "_integrity": "sha512-ezXZk6oPJCWL483zj64pNkMuY/NcRX5MPiB0zE6tjZM137aeusrOnW1ecxgF9cmwMWkBMhjteQxBPoZBh9FDxQ==", |
... | ... | @@ -8,12 +8,12 @@ |
8 | 8 | "_requested": { |
9 | 9 | "type": "range", |
10 | 10 | "registry": true, |
11 | - "raw": "log4js@^3.0.4", | |
11 | + "raw": "log4js@^3.0.6", | |
12 | 12 | "name": "log4js", |
13 | 13 | "escapedName": "log4js", |
14 | - "rawSpec": "^3.0.4", | |
14 | + "rawSpec": "^3.0.6", | |
15 | 15 | "saveSpec": null, |
16 | - "fetchSpec": "^3.0.4" | |
16 | + "fetchSpec": "^3.0.6" | |
17 | 17 | }, |
18 | 18 | "_requiredBy": [ |
19 | 19 | "#USER", |
... | ... | @@ -21,8 +21,8 @@ |
21 | 21 | ], |
22 | 22 | "_resolved": "https://registry.npmjs.org/log4js/-/log4js-3.0.6.tgz", |
23 | 23 | "_shasum": "e6caced94967eeeb9ce399f9f8682a4b2b28c8ff", |
24 | - "_spec": "log4js@^3.0.4", | |
25 | - "_where": "C:\\Users\\admin\\Documents\\express-project", | |
24 | + "_spec": "log4js@^3.0.6", | |
25 | + "_where": "C:\\myWork\\git\\hospital", | |
26 | 26 | "author": { |
27 | 27 | "name": "Gareth Jones", |
28 | 28 | "email": "gareth.nomiddlename@gmail.com" | ... | ... |
node_modules/log4js/types/log4js.d.ts
... | ... | @@ -1,297 +0,0 @@ |
1 | -// Type definitions for log4js | |
2 | - | |
3 | -type Format = string | ((req: any, res: any, formatter: ((str: string) => string)) => string); | |
4 | - | |
5 | -export interface Log4js { | |
6 | - getLogger(category?: string): Logger; | |
7 | - configure(filename: string): Log4js; | |
8 | - configure(config: Configuration): Log4js; | |
9 | - addLayout(name: string, config: (a: any) => (logEvent: LoggingEvent) => string): void; | |
10 | - connectLogger(logger: Logger, options: { format?: Format; level?: string; nolog?: any; }): any; // express.Handler; | |
11 | - levels: Levels; | |
12 | - shutdown(cb: (error: Error) => void): void | null; | |
13 | -} | |
14 | - | |
15 | -export function getLogger(category?: string): Logger; | |
16 | - | |
17 | -export function configure(filename: string): Log4js; | |
18 | -export function configure(config: Configuration): Log4js; | |
19 | - | |
20 | -export function addLayout(name: string, config: (a: any) => (logEvent: LoggingEvent) => string): void; | |
21 | - | |
22 | -export function connectLogger(logger: Logger, options: { format?: Format; level?: string; nolog?: any; }): any; // express.Handler; | |
23 | - | |
24 | -export const levels: Levels; | |
25 | - | |
26 | -export function shutdown(cb?: (error: Error) => void): void | null; | |
27 | - | |
28 | -export interface BaseLayout { | |
29 | - type: 'basic'; | |
30 | -} | |
31 | - | |
32 | -export interface ColoredLayout { | |
33 | - type: 'colored' | 'coloured'; | |
34 | -} | |
35 | - | |
36 | -export interface MessagePassThroughLayout { | |
37 | - type: 'messagePassThrough'; | |
38 | -} | |
39 | - | |
40 | -export interface DummyLayout { | |
41 | - type: 'dummy'; | |
42 | -} | |
43 | - | |
44 | -export interface Level { | |
45 | - isEqualTo(other: string): boolean; | |
46 | - isEqualTo(otherLevel: Level): boolean; | |
47 | - isLessThanOrEqualTo(other: string): boolean; | |
48 | - isLessThanOrEqualTo(otherLevel: Level): boolean; | |
49 | - isGreaterThanOrEqualTo(other: string): boolean; | |
50 | - isGreaterThanOrEqualTo(otherLevel: Level): boolean; | |
51 | -} | |
52 | - | |
53 | -export interface LoggingEvent { | |
54 | - categoryName: string; // name of category | |
55 | - level: Level; // level of message | |
56 | - data: any[]; // objects to log | |
57 | - startTime: Date; | |
58 | - pid: number; | |
59 | - context: any; | |
60 | - cluster?: { | |
61 | - workerId: number; | |
62 | - worker: number; | |
63 | - }; | |
64 | -} | |
65 | - | |
66 | -export type Token = ((logEvent: LoggingEvent) => string) | string; | |
67 | - | |
68 | -export interface PatternLayout { | |
69 | - type: 'pattern'; | |
70 | - // specifier for the output format, using placeholders as described below | |
71 | - pattern: string; | |
72 | - // user-defined tokens to be used in the pattern | |
73 | - tokens?: { [name: string]: Token }; | |
74 | -} | |
75 | - | |
76 | -export interface CustomLayout { | |
77 | - [key: string]: any; | |
78 | - type: string; | |
79 | -} | |
80 | - | |
81 | -export type Layout = BaseLayout | ColoredLayout | MessagePassThroughLayout | DummyLayout | PatternLayout | CustomLayout; | |
82 | - | |
83 | -/** | |
84 | - * Category Filter | |
85 | - * | |
86 | - * @see https://log4js-node.github.io/log4js-node/categoryFilter.html | |
87 | - */ | |
88 | -export interface CategoryFilterAppender { | |
89 | - type: "categoryFilter"; | |
90 | - // the category (or categories if you provide an array of values) that will be excluded from the appender. | |
91 | - exclude?: string | string[]; | |
92 | - // the name of the appender to filter. see https://log4js-node.github.io/log4js-node/layouts.html | |
93 | - appender?: string; | |
94 | -} | |
95 | - | |
96 | -/** | |
97 | - * Console Appender | |
98 | - * | |
99 | - * @see https://log4js-node.github.io/log4js-node/console.html | |
100 | - */ | |
101 | -export interface ConsoleAppender { | |
102 | - type: 'console'; | |
103 | - // defaults to colouredLayout | |
104 | - layout?: Layout; | |
105 | -} | |
106 | - | |
107 | -export interface FileAppender { | |
108 | - type: 'file'; | |
109 | - // the path of the file where you want your logs written. | |
110 | - filename: string; | |
111 | - // the maximum size (in bytes) for the log file. If not specified, then no log rolling will happen. | |
112 | - maxLogSize?: number | string; | |
113 | - // (default value = 5) - the number of old log files to keep during log rolling. | |
114 | - backups?: number; | |
115 | - // defaults to basic layout | |
116 | - layout?: Layout; | |
117 | - numBackups?: number; | |
118 | - compress?: boolean; // compress the backups | |
119 | - // keep the file extension when rotating logs | |
120 | - keepFileExt?: boolean; | |
121 | - encoding?: string; | |
122 | - mode?: number; | |
123 | - flags?: string; | |
124 | -} | |
125 | - | |
126 | -export interface SyncfileAppender { | |
127 | - type: 'fileSync'; | |
128 | - // the path of the file where you want your logs written. | |
129 | - filename: string; | |
130 | - // the maximum size (in bytes) for the log file. If not specified, then no log rolling will happen. | |
131 | - maxLogSize?: number | string; | |
132 | - // (default value = 5) - the number of old log files to keep during log rolling. | |
133 | - backups?: number; | |
134 | - // defaults to basic layout | |
135 | - layout?: Layout; | |
136 | -} | |
137 | - | |
138 | -export interface DateFileAppender { | |
139 | - type: 'dateFile'; | |
140 | - // the path of the file where you want your logs written. | |
141 | - filename: string; | |
142 | - // defaults to basic layout | |
143 | - layout?: Layout; | |
144 | - // defaults to .yyyy-MM-dd - the pattern to use to determine when to roll the logs. | |
145 | - /** | |
146 | - * The following strings are recognised in the pattern: | |
147 | - * - yyyy : the full year, use yy for just the last two digits | |
148 | - * - MM : the month | |
149 | - * - dd : the day of the month | |
150 | - * - hh : the hour of the day (24-hour clock) | |
151 | - * - mm : the minute of the hour | |
152 | - * - ss : seconds | |
153 | - * - SSS : milliseconds (although I'm not sure you'd want to roll your logs every millisecond) | |
154 | - * - O : timezone (capital letter o) | |
155 | - */ | |
156 | - pattern?: string; | |
157 | - // default โutf-8โ | |
158 | - encoding?: string; | |
159 | - // default 0644 | |
160 | - mode?: number; | |
161 | - // default โaโ | |
162 | - flags?: string; | |
163 | - // compress the backup files during rolling (backup files will have .gz extension)(default false) | |
164 | - compress?: boolean; | |
165 | - // include the pattern in the name of the current log file as well as the backups.(default false) | |
166 | - alwaysIncludePattern?: boolean; | |
167 | - // keep the file extension when rotating logs | |
168 | - keepFileExt?: boolean; | |
169 | - // if this value is greater than zero, then files older than that many days will be deleted during log rolling.(default 0) | |
170 | - daysToKeep?: number; | |
171 | -} | |
172 | - | |
173 | -export interface LogLevelFilterAppender { | |
174 | - type: 'logLevelFilter'; | |
175 | - // the name of an appender, defined in the same configuration, that you want to filter | |
176 | - appender: string; | |
177 | - // the minimum level of event to allow through the filter | |
178 | - level: string; | |
179 | - // (defaults to FATAL) - the maximum level of event to allow through the filter | |
180 | - maxLevel?: string; | |
181 | -} | |
182 | - | |
183 | -export interface MultiFileAppender { | |
184 | - type: 'multiFile'; | |
185 | - // the base part of the generated log filename | |
186 | - base: string; | |
187 | - // the value to use to split files (see below). | |
188 | - property: string; | |
189 | - // the suffix for the generated log filename. | |
190 | - extension: string; | |
191 | -} | |
192 | - | |
193 | -export interface MultiprocessAppender { | |
194 | - type: 'multiprocess'; | |
195 | - // controls whether the appender listens for log events sent over the network, or is responsible for serialising events and sending them to a server. | |
196 | - mode: 'master' | 'worker'; | |
197 | - // (only needed if mode == master)- the name of the appender to send the log events to | |
198 | - appender?: string; | |
199 | - // (defaults to 5000) - the port to listen on, or send to | |
200 | - loggerPort?: number; | |
201 | - // (defaults to localhost) - the host/IP address to listen on, or send to | |
202 | - loggerHost?: string; | |
203 | -} | |
204 | - | |
205 | -export interface RecordingAppender { | |
206 | - type: 'recording'; | |
207 | -} | |
208 | - | |
209 | -export interface StandardErrorAppender { | |
210 | - type: 'stderr'; | |
211 | - // (defaults to colouredLayout) | |
212 | - layout?: Layout; | |
213 | -} | |
214 | - | |
215 | -export interface StandardOutputAppender { | |
216 | - type: 'stdout'; | |
217 | - // (defaults to colouredLayout) | |
218 | - layout?: Layout; | |
219 | -} | |
220 | - | |
221 | -export interface CustomAppender { | |
222 | - type: string; | |
223 | - [key: string]: any; | |
224 | -} | |
225 | - | |
226 | -export type Appender = CategoryFilterAppender | |
227 | - | ConsoleAppender | |
228 | - | FileAppender | |
229 | - | SyncfileAppender | |
230 | - | DateFileAppender | |
231 | - | LogLevelFilterAppender | |
232 | - | MultiFileAppender | |
233 | - | MultiprocessAppender | |
234 | - | RecordingAppender | |
235 | - | StandardErrorAppender | |
236 | - | StandardOutputAppender | |
237 | - | CustomAppender; | |
238 | - | |
239 | -export interface Levels { | |
240 | - ALL: Level; | |
241 | - MARK: Level; | |
242 | - TRACE: Level; | |
243 | - DEBUG: Level; | |
244 | - INFO: Level; | |
245 | - WARN: Level; | |
246 | - ERROR: Level; | |
247 | - FATAL: Level; | |
248 | - OFF: Level; | |
249 | - levels: Level[]; | |
250 | - getLevel(level: string): Level; | |
251 | -} | |
252 | - | |
253 | -export interface Configuration { | |
254 | - appenders: { [name: string]: Appender; }; | |
255 | - categories: { [name: string]: { appenders: string[]; level: string; } }; | |
256 | - pm2?: boolean; | |
257 | - pm2InstanceVar?: string; | |
258 | - levels?: Levels; | |
259 | - disableClustering?: boolean; | |
260 | -} | |
261 | - | |
262 | -export class Logger { | |
263 | - new(dispatch: Function, name: string): Logger; | |
264 | - | |
265 | - level: string; | |
266 | - | |
267 | - log(...args: any[]): void; | |
268 | - | |
269 | - isLevelEnabled(level?: string): boolean; | |
270 | - | |
271 | - isTraceEnabled(): boolean; | |
272 | - isDebugEnabled(): boolean; | |
273 | - isInfoEnabled(): boolean; | |
274 | - isWarnEnabled(): boolean; | |
275 | - isErrorEnabled(): boolean; | |
276 | - isFatalEnabled(): boolean; | |
277 | - | |
278 | - _log(level: string, data: any): void; | |
279 | - | |
280 | - addContext(key: string, value: any): void; | |
281 | - | |
282 | - removeContext(key: string): void; | |
283 | - | |
284 | - clearContext(): void; | |
285 | - | |
286 | - trace(message: any, ...args: any[]): void; | |
287 | - | |
288 | - debug(message: any, ...args: any[]): void; | |
289 | - | |
290 | - info(message: any, ...args: any[]): void; | |
291 | - | |
292 | - warn(message: any, ...args: any[]): void; | |
293 | - | |
294 | - error(message: any, ...args: any[]): void; | |
295 | - | |
296 | - fatal(message: any, ...args: any[]): void; | |
297 | -} |
node_modules/log4js/types/test.ts
... | ... | @@ -1,131 +0,0 @@ |
1 | -import * as log4js from './log4js'; | |
2 | - | |
3 | -log4js.configure('./filename'); | |
4 | -const logger1 = log4js.getLogger(); | |
5 | -logger1.level = 'debug'; | |
6 | -logger1.debug("Some debug messages"); | |
7 | -logger1.fatal({ | |
8 | - whatever: 'foo' | |
9 | -}) | |
10 | - | |
11 | -const logger3 = log4js.getLogger('cheese'); | |
12 | -logger3.trace('Entering cheese testing'); | |
13 | -logger3.debug('Got cheese.'); | |
14 | -logger3.info('Cheese is Gouda.'); | |
15 | -logger3.warn('Cheese is quite smelly.'); | |
16 | -logger3.error('Cheese is too ripe!'); | |
17 | -logger3.fatal('Cheese was breeding ground for listeria.'); | |
18 | - | |
19 | -log4js.configure({ | |
20 | - appenders: { cheese: { type: 'console', filename: 'cheese.log' } }, | |
21 | - categories: { default: { appenders: ['cheese'], level: 'error' } } | |
22 | -}); | |
23 | - | |
24 | -log4js.configure({ | |
25 | - appenders: { | |
26 | - out: { type: 'file', filename: 'pm2logs.log' } | |
27 | - }, | |
28 | - categories: { | |
29 | - default: { appenders: ['out'], level: 'info' } | |
30 | - }, | |
31 | - pm2: true, | |
32 | - pm2InstanceVar: 'INSTANCE_ID' | |
33 | -}); | |
34 | - | |
35 | -log4js.addLayout('json', config => function (logEvent) { | |
36 | - return JSON.stringify(logEvent) + config.separator; | |
37 | -}); | |
38 | - | |
39 | -log4js.configure({ | |
40 | - appenders: { | |
41 | - out: { type: 'stdout', layout: { type: 'json', separator: ',' } } | |
42 | - }, | |
43 | - categories: { | |
44 | - default: { appenders: ['out'], level: 'info' } | |
45 | - } | |
46 | -}); | |
47 | - | |
48 | -log4js.configure({ | |
49 | - appenders: { | |
50 | - file: { type: 'dateFile', filename: 'thing.log', pattern: '.mm' } | |
51 | - }, | |
52 | - categories: { | |
53 | - default: { appenders: ['file'], level: 'debug' } | |
54 | - } | |
55 | -}); | |
56 | - | |
57 | -const logger4 = log4js.getLogger('thing'); | |
58 | -logger4.log('logging a thing'); | |
59 | - | |
60 | -const logger5 = log4js.getLogger('json-test'); | |
61 | -logger5.info('this is just a test'); | |
62 | -logger5.error('of a custom appender'); | |
63 | -logger5.warn('that outputs json'); | |
64 | -log4js.shutdown(() => { }); | |
65 | - | |
66 | -log4js.configure({ | |
67 | - appenders: { | |
68 | - cheeseLogs: { type: 'file', filename: 'cheese.log' }, | |
69 | - console: { type: 'console' } | |
70 | - }, | |
71 | - categories: { | |
72 | - cheese: { appenders: ['cheeseLogs'], level: 'error' }, | |
73 | - another: { appenders: ['console'], level: 'trace' }, | |
74 | - default: { appenders: ['console', 'cheeseLogs'], level: 'trace' } | |
75 | - } | |
76 | -}); | |
77 | - | |
78 | -const logger6 = log4js.getLogger('cheese'); | |
79 | -// only errors and above get logged. | |
80 | -const otherLogger = log4js.getLogger(); | |
81 | - | |
82 | -// this will get coloured output on console, and appear in cheese.log | |
83 | -otherLogger.error('AAArgh! Something went wrong', { some: 'otherObject', useful_for: 'debug purposes' }); | |
84 | -otherLogger.log('This should appear as info output'); | |
85 | - | |
86 | -// these will not appear (logging level beneath error) | |
87 | -logger6.trace('Entering cheese testing'); | |
88 | -logger6.debug('Got cheese.'); | |
89 | -logger6.info('Cheese is Gouda.'); | |
90 | -logger6.log('Something funny about cheese.'); | |
91 | -logger6.warn('Cheese is quite smelly.'); | |
92 | -// these end up only in cheese.log | |
93 | -logger6.error('Cheese %s is too ripe!', 'gouda'); | |
94 | -logger6.fatal('Cheese was breeding ground for listeria.'); | |
95 | - | |
96 | -// these don't end up in cheese.log, but will appear on the console | |
97 | -const anotherLogger = log4js.getLogger('another'); | |
98 | -anotherLogger.debug('Just checking'); | |
99 | - | |
100 | -// will also go to console and cheese.log, since that's configured for all categories | |
101 | -const pantsLog = log4js.getLogger('pants'); | |
102 | -pantsLog.debug('Something for pants'); | |
103 | - | |
104 | - | |
105 | -import { configure, getLogger } from './log4js'; | |
106 | -configure('./filename'); | |
107 | -const logger2 = getLogger(); | |
108 | -logger2.level = 'debug'; | |
109 | -logger2.debug("Some debug messages"); | |
110 | - | |
111 | -configure({ | |
112 | - appenders: { cheese: { type: 'file', filename: 'cheese.log' } }, | |
113 | - categories: { default: { appenders: ['cheese'], level: 'error' } } | |
114 | -}); | |
115 | - | |
116 | -log4js.configure('./filename').getLogger(); | |
117 | -const logger7 = log4js.getLogger(); | |
118 | -logger7.level = 'debug'; | |
119 | -logger7.debug("Some debug messages"); | |
120 | - | |
121 | -const levels: log4js.Levels = log4js.levels; | |
122 | -const level: log4js.Level = levels.getLevel('info'); | |
123 | - | |
124 | -log4js.connectLogger(logger1, { | |
125 | - format: ':x, :y', | |
126 | - level: 'info' | |
127 | -}); | |
128 | - | |
129 | -log4js.connectLogger(logger2, { | |
130 | - format: (req, _res, format) => format(`:remote-addr - ${req.id} - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"`) | |
131 | -}); |
node_modules/log4js/types/tsconfig.json
package-lock.json
... | ... | @@ -18,6 +18,11 @@ |
18 | 18 | "lodash.kebabcase": "4.1.1" |
19 | 19 | } |
20 | 20 | }, |
21 | + "abbrev": { | |
22 | + "version": "1.1.1", | |
23 | + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", | |
24 | + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" | |
25 | + }, | |
21 | 26 | "accepts": { |
22 | 27 | "version": "1.3.5", |
23 | 28 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", |
... | ... | @@ -27,6 +32,17 @@ |
27 | 32 | "negotiator": "0.6.1" |
28 | 33 | } |
29 | 34 | }, |
35 | + "ajv": { | |
36 | + "version": "5.5.2", | |
37 | + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", | |
38 | + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", | |
39 | + "requires": { | |
40 | + "co": "4.6.0", | |
41 | + "fast-deep-equal": "1.1.0", | |
42 | + "fast-json-stable-stringify": "2.0.0", | |
43 | + "json-schema-traverse": "0.3.1" | |
44 | + } | |
45 | + }, | |
30 | 46 | "align-text": { |
31 | 47 | "version": "0.1.4", |
32 | 48 | "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", |
... | ... | @@ -52,6 +68,20 @@ |
52 | 68 | "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", |
53 | 69 | "integrity": "sha1-ZBqlXft9am8KgUHEucCqULbCTdU=" |
54 | 70 | }, |
71 | + "aproba": { | |
72 | + "version": "1.2.0", | |
73 | + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", | |
74 | + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" | |
75 | + }, | |
76 | + "are-we-there-yet": { | |
77 | + "version": "1.1.5", | |
78 | + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", | |
79 | + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", | |
80 | + "requires": { | |
81 | + "delegates": "1.0.0", | |
82 | + "readable-stream": "2.3.6" | |
83 | + } | |
84 | + }, | |
55 | 85 | "array-flatten": { |
56 | 86 | "version": "1.1.1", |
57 | 87 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", |
... | ... | @@ -78,6 +108,11 @@ |
78 | 108 | "lodash": "4.17.11" |
79 | 109 | } |
80 | 110 | }, |
111 | + "asynckit": { | |
112 | + "version": "0.4.0", | |
113 | + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", | |
114 | + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" | |
115 | + }, | |
81 | 116 | "aws-sign2": { |
82 | 117 | "version": "0.6.0", |
83 | 118 | "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", |
... | ... | @@ -101,6 +136,14 @@ |
101 | 136 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", |
102 | 137 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" |
103 | 138 | }, |
139 | + "basic-auth": { | |
140 | + "version": "2.0.1", | |
141 | + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", | |
142 | + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", | |
143 | + "requires": { | |
144 | + "safe-buffer": "5.1.2" | |
145 | + } | |
146 | + }, | |
104 | 147 | "bcrypt-pbkdf": { |
105 | 148 | "version": "1.0.2", |
106 | 149 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", |
... | ... | @@ -241,6 +284,11 @@ |
241 | 284 | "es6-object-assign": "1.1.0" |
242 | 285 | } |
243 | 286 | }, |
287 | + "chownr": { | |
288 | + "version": "1.1.1", | |
289 | + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", | |
290 | + "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==" | |
291 | + }, | |
244 | 292 | "circular-json": { |
245 | 293 | "version": "0.5.7", |
246 | 294 | "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.5.7.tgz", |
... | ... | @@ -256,6 +304,16 @@ |
256 | 304 | "wordwrap": "0.0.2" |
257 | 305 | } |
258 | 306 | }, |
307 | + "co": { | |
308 | + "version": "4.6.0", | |
309 | + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", | |
310 | + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" | |
311 | + }, | |
312 | + "code-point-at": { | |
313 | + "version": "1.1.0", | |
314 | + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", | |
315 | + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" | |
316 | + }, | |
259 | 317 | "color": { |
260 | 318 | "version": "3.0.0", |
261 | 319 | "resolved": "https://registry.npmjs.org/color/-/color-3.0.0.tgz", |
... | ... | @@ -319,6 +377,18 @@ |
319 | 377 | "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", |
320 | 378 | "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" |
321 | 379 | }, |
380 | + "commonlog-kb": { | |
381 | + "version": "1.3.5", | |
382 | + "resolved": "https://registry.npmjs.org/commonlog-kb/-/commonlog-kb-1.3.5.tgz", | |
383 | + "integrity": "sha512-kU73yTQtO67Cs84+OL8Fi/xlbIT1fQ+vl4pcd69kkW+8PU2JZD9lRtcJ+K/AeKh+LUiTQdxrsQP/9sUJG4UD1A==", | |
384 | + "requires": { | |
385 | + "dateformat": "3.0.3", | |
386 | + "node-cron": "1.2.1", | |
387 | + "on-headers": "1.0.1", | |
388 | + "rotating-file-stream": "1.3.9", | |
389 | + "sqlite3": "4.0.2" | |
390 | + } | |
391 | + }, | |
322 | 392 | "concat-map": { |
323 | 393 | "version": "0.0.1", |
324 | 394 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", |
... | ... | @@ -363,6 +433,11 @@ |
363 | 433 | } |
364 | 434 | } |
365 | 435 | }, |
436 | + "console-control-strings": { | |
437 | + "version": "1.1.0", | |
438 | + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", | |
439 | + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" | |
440 | + }, | |
366 | 441 | "content-disposition": { |
367 | 442 | "version": "0.5.2", |
368 | 443 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", |
... | ... | @@ -435,6 +510,11 @@ |
435 | 510 | "resolved": "https://registry.npmjs.org/date-format/-/date-format-1.2.0.tgz", |
436 | 511 | "integrity": "sha1-YV6CjiM90aubua4JUODOzPpuytg=" |
437 | 512 | }, |
513 | + "dateformat": { | |
514 | + "version": "3.0.3", | |
515 | + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", | |
516 | + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==" | |
517 | + }, | |
438 | 518 | "debug": { |
439 | 519 | "version": "2.6.9", |
440 | 520 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", |
... | ... | @@ -448,11 +528,21 @@ |
448 | 528 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", |
449 | 529 | "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" |
450 | 530 | }, |
531 | + "deep-extend": { | |
532 | + "version": "0.6.0", | |
533 | + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", | |
534 | + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" | |
535 | + }, | |
451 | 536 | "delayed-stream": { |
452 | 537 | "version": "0.0.5", |
453 | 538 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz", |
454 | 539 | "integrity": "sha1-1LH0OpPoKW3+AmlPRoC8N6MTxz8=" |
455 | 540 | }, |
541 | + "delegates": { | |
542 | + "version": "1.0.0", | |
543 | + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", | |
544 | + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" | |
545 | + }, | |
456 | 546 | "depd": { |
457 | 547 | "version": "1.1.2", |
458 | 548 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", |
... | ... | @@ -463,6 +553,11 @@ |
463 | 553 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", |
464 | 554 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" |
465 | 555 | }, |
556 | + "detect-libc": { | |
557 | + "version": "1.0.3", | |
558 | + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", | |
559 | + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" | |
560 | + }, | |
466 | 561 | "diagnostics": { |
467 | 562 | "version": "1.1.1", |
468 | 563 | "resolved": "https://registry.npmjs.org/diagnostics/-/diagnostics-1.1.1.tgz", |
... | ... | @@ -646,6 +741,16 @@ |
646 | 741 | "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", |
647 | 742 | "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" |
648 | 743 | }, |
744 | + "fast-deep-equal": { | |
745 | + "version": "1.1.0", | |
746 | + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", | |
747 | + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" | |
748 | + }, | |
749 | + "fast-json-stable-stringify": { | |
750 | + "version": "2.0.0", | |
751 | + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", | |
752 | + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" | |
753 | + }, | |
649 | 754 | "fast-safe-stringify": { |
650 | 755 | "version": "2.0.6", |
651 | 756 | "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.6.tgz", |
... | ... | @@ -715,11 +820,34 @@ |
715 | 820 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", |
716 | 821 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" |
717 | 822 | }, |
823 | + "fs-minipass": { | |
824 | + "version": "1.2.5", | |
825 | + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", | |
826 | + "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", | |
827 | + "requires": { | |
828 | + "minipass": "2.3.4" | |
829 | + } | |
830 | + }, | |
718 | 831 | "fs.realpath": { |
719 | 832 | "version": "1.0.0", |
720 | 833 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", |
721 | 834 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" |
722 | 835 | }, |
836 | + "gauge": { | |
837 | + "version": "2.7.4", | |
838 | + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", | |
839 | + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", | |
840 | + "requires": { | |
841 | + "aproba": "1.2.0", | |
842 | + "console-control-strings": "1.1.0", | |
843 | + "has-unicode": "2.0.1", | |
844 | + "object-assign": "4.1.1", | |
845 | + "signal-exit": "3.0.2", | |
846 | + "string-width": "1.0.2", | |
847 | + "strip-ansi": "3.0.1", | |
848 | + "wide-align": "1.1.3" | |
849 | + } | |
850 | + }, | |
723 | 851 | "generate-function": { |
724 | 852 | "version": "2.3.1", |
725 | 853 | "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", |
... | ... | @@ -769,6 +897,11 @@ |
769 | 897 | "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", |
770 | 898 | "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==" |
771 | 899 | }, |
900 | + "har-schema": { | |
901 | + "version": "2.0.0", | |
902 | + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", | |
903 | + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" | |
904 | + }, | |
772 | 905 | "har-validator": { |
773 | 906 | "version": "2.0.6", |
774 | 907 | "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", |
... | ... | @@ -793,6 +926,11 @@ |
793 | 926 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", |
794 | 927 | "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" |
795 | 928 | }, |
929 | + "has-unicode": { | |
930 | + "version": "2.0.1", | |
931 | + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", | |
932 | + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" | |
933 | + }, | |
796 | 934 | "hawk": { |
797 | 935 | "version": "3.1.3", |
798 | 936 | "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", |
... | ... | @@ -851,6 +989,14 @@ |
851 | 989 | "safer-buffer": "2.1.2" |
852 | 990 | } |
853 | 991 | }, |
992 | + "ignore-walk": { | |
993 | + "version": "3.0.1", | |
994 | + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", | |
995 | + "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", | |
996 | + "requires": { | |
997 | + "minimatch": "3.0.4" | |
998 | + } | |
999 | + }, | |
854 | 1000 | "indicative": { |
855 | 1001 | "version": "3.0.6", |
856 | 1002 | "resolved": "https://registry.npmjs.org/indicative/-/indicative-3.0.6.tgz", |
... | ... | @@ -881,6 +1027,11 @@ |
881 | 1027 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", |
882 | 1028 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" |
883 | 1029 | }, |
1030 | + "ini": { | |
1031 | + "version": "1.3.5", | |
1032 | + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", | |
1033 | + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" | |
1034 | + }, | |
884 | 1035 | "ipaddr.js": { |
885 | 1036 | "version": "1.8.0", |
886 | 1037 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", |
... | ... | @@ -896,6 +1047,14 @@ |
896 | 1047 | "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", |
897 | 1048 | "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" |
898 | 1049 | }, |
1050 | + "is-fullwidth-code-point": { | |
1051 | + "version": "1.0.0", | |
1052 | + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", | |
1053 | + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", | |
1054 | + "requires": { | |
1055 | + "number-is-nan": "1.0.1" | |
1056 | + } | |
1057 | + }, | |
899 | 1058 | "is-my-ip-valid": { |
900 | 1059 | "version": "1.0.0", |
901 | 1060 | "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", |
... | ... | @@ -948,6 +1107,11 @@ |
948 | 1107 | "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", |
949 | 1108 | "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" |
950 | 1109 | }, |
1110 | + "json-schema-traverse": { | |
1111 | + "version": "0.3.1", | |
1112 | + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", | |
1113 | + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" | |
1114 | + }, | |
951 | 1115 | "json-stringify-safe": { |
952 | 1116 | "version": "5.0.1", |
953 | 1117 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", |
... | ... | @@ -1154,6 +1318,23 @@ |
1154 | 1318 | "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", |
1155 | 1319 | "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" |
1156 | 1320 | }, |
1321 | + "minipass": { | |
1322 | + "version": "2.3.4", | |
1323 | + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.4.tgz", | |
1324 | + "integrity": "sha512-mlouk1OHlaUE8Odt1drMtG1bAJA4ZA6B/ehysgV0LUIrDHdKgo1KorZq3pK0b/7Z7LJIQ12MNM6aC+Tn6lUZ5w==", | |
1325 | + "requires": { | |
1326 | + "safe-buffer": "5.1.2", | |
1327 | + "yallist": "3.0.2" | |
1328 | + } | |
1329 | + }, | |
1330 | + "minizlib": { | |
1331 | + "version": "1.1.1", | |
1332 | + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.1.tgz", | |
1333 | + "integrity": "sha512-TrfjCjk4jLhcJyGMYymBH6oTXcWjYbUAXTHDbtnWHjZC25h0cdajHuPE1zxb4DVmu8crfh+HwH/WMuyLG0nHBg==", | |
1334 | + "requires": { | |
1335 | + "minipass": "2.3.4" | |
1336 | + } | |
1337 | + }, | |
1157 | 1338 | "mkdirp": { |
1158 | 1339 | "version": "0.5.1", |
1159 | 1340 | "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", |
... | ... | @@ -1228,6 +1409,18 @@ |
1228 | 1409 | "saslprep": "1.0.2" |
1229 | 1410 | } |
1230 | 1411 | }, |
1412 | + "morgan": { | |
1413 | + "version": "1.9.1", | |
1414 | + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz", | |
1415 | + "integrity": "sha512-HQStPIV4y3afTiCYVxirakhlCfGkI161c76kKFca7Fk1JusM//Qeo1ej2XaMniiNeaZklMVrh3vTtIzpzwbpmA==", | |
1416 | + "requires": { | |
1417 | + "basic-auth": "2.0.1", | |
1418 | + "debug": "2.6.9", | |
1419 | + "depd": "1.1.2", | |
1420 | + "on-finished": "2.3.0", | |
1421 | + "on-headers": "1.0.1" | |
1422 | + } | |
1423 | + }, | |
1231 | 1424 | "ms": { |
1232 | 1425 | "version": "2.0.0", |
1233 | 1426 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", |
... | ... | @@ -1256,11 +1449,26 @@ |
1256 | 1449 | "integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=", |
1257 | 1450 | "optional": true |
1258 | 1451 | }, |
1452 | + "needle": { | |
1453 | + "version": "2.2.4", | |
1454 | + "resolved": "https://registry.npmjs.org/needle/-/needle-2.2.4.tgz", | |
1455 | + "integrity": "sha512-HyoqEb4wr/rsoaIDfTH2aVL9nWtQqba2/HvMv+++m8u0dz808MaagKILxtfeSN7QU7nvbQ79zk3vYOJp9zsNEA==", | |
1456 | + "requires": { | |
1457 | + "debug": "2.6.9", | |
1458 | + "iconv-lite": "0.4.23", | |
1459 | + "sax": "1.2.4" | |
1460 | + } | |
1461 | + }, | |
1259 | 1462 | "negotiator": { |
1260 | 1463 | "version": "0.6.1", |
1261 | 1464 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", |
1262 | 1465 | "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" |
1263 | 1466 | }, |
1467 | + "node-cron": { | |
1468 | + "version": "1.2.1", | |
1469 | + "resolved": "https://registry.npmjs.org/node-cron/-/node-cron-1.2.1.tgz", | |
1470 | + "integrity": "sha1-jJC8XccjpWKJsHhmVatKHEy2A2g=" | |
1471 | + }, | |
1264 | 1472 | "node-forge": { |
1265 | 1473 | "version": "0.7.6", |
1266 | 1474 | "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.6.tgz", |
... | ... | @@ -1271,11 +1479,82 @@ |
1271 | 1479 | "resolved": "https://registry.npmjs.org/node-json-config/-/node-json-config-0.0.4.tgz", |
1272 | 1480 | "integrity": "sha1-6e+xih5l/TSMudKVGIlwjmaEheo=" |
1273 | 1481 | }, |
1482 | + "node-pre-gyp": { | |
1483 | + "version": "0.10.3", | |
1484 | + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz", | |
1485 | + "integrity": "sha512-d1xFs+C/IPS8Id0qPTZ4bUT8wWryfR/OzzAFxweG+uLN85oPzyo2Iw6bVlLQ/JOdgNonXLCoRyqDzDWq4iw72A==", | |
1486 | + "requires": { | |
1487 | + "detect-libc": "1.0.3", | |
1488 | + "mkdirp": "0.5.1", | |
1489 | + "needle": "2.2.4", | |
1490 | + "nopt": "4.0.1", | |
1491 | + "npm-packlist": "1.1.12", | |
1492 | + "npmlog": "4.1.2", | |
1493 | + "rc": "1.2.8", | |
1494 | + "rimraf": "2.6.2", | |
1495 | + "semver": "5.6.0", | |
1496 | + "tar": "4.4.6" | |
1497 | + }, | |
1498 | + "dependencies": { | |
1499 | + "rimraf": { | |
1500 | + "version": "2.6.2", | |
1501 | + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", | |
1502 | + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", | |
1503 | + "requires": { | |
1504 | + "glob": "7.1.2" | |
1505 | + } | |
1506 | + } | |
1507 | + } | |
1508 | + }, | |
1509 | + "nopt": { | |
1510 | + "version": "4.0.1", | |
1511 | + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", | |
1512 | + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", | |
1513 | + "requires": { | |
1514 | + "abbrev": "1.1.1", | |
1515 | + "osenv": "0.1.5" | |
1516 | + } | |
1517 | + }, | |
1518 | + "npm-bundled": { | |
1519 | + "version": "1.0.5", | |
1520 | + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.5.tgz", | |
1521 | + "integrity": "sha512-m/e6jgWu8/v5niCUKQi9qQl8QdeEduFA96xHDDzFGqly0OOjI7c+60KM/2sppfnUU9JJagf+zs+yGhqSOFj71g==" | |
1522 | + }, | |
1523 | + "npm-packlist": { | |
1524 | + "version": "1.1.12", | |
1525 | + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.1.12.tgz", | |
1526 | + "integrity": "sha512-WJKFOVMeAlsU/pjXuqVdzU0WfgtIBCupkEVwn+1Y0ERAbUfWw8R4GjgVbaKnUjRoD2FoQbHOCbOyT5Mbs9Lw4g==", | |
1527 | + "requires": { | |
1528 | + "ignore-walk": "3.0.1", | |
1529 | + "npm-bundled": "1.0.5" | |
1530 | + } | |
1531 | + }, | |
1532 | + "npmlog": { | |
1533 | + "version": "4.1.2", | |
1534 | + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", | |
1535 | + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", | |
1536 | + "requires": { | |
1537 | + "are-we-there-yet": "1.1.5", | |
1538 | + "console-control-strings": "1.1.0", | |
1539 | + "gauge": "2.7.4", | |
1540 | + "set-blocking": "2.0.0" | |
1541 | + } | |
1542 | + }, | |
1543 | + "number-is-nan": { | |
1544 | + "version": "1.0.1", | |
1545 | + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", | |
1546 | + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" | |
1547 | + }, | |
1274 | 1548 | "oauth-sign": { |
1275 | 1549 | "version": "0.8.2", |
1276 | 1550 | "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", |
1277 | 1551 | "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" |
1278 | 1552 | }, |
1553 | + "object-assign": { | |
1554 | + "version": "4.1.1", | |
1555 | + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", | |
1556 | + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" | |
1557 | + }, | |
1279 | 1558 | "on-finished": { |
1280 | 1559 | "version": "2.3.0", |
1281 | 1560 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", |
... | ... | @@ -1302,6 +1581,25 @@ |
1302 | 1581 | "resolved": "https://registry.npmjs.org/one-time/-/one-time-0.0.4.tgz", |
1303 | 1582 | "integrity": "sha1-+M33eISCb+Tf+T46nMN7HkSAdC4=" |
1304 | 1583 | }, |
1584 | + "os-homedir": { | |
1585 | + "version": "1.0.2", | |
1586 | + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", | |
1587 | + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" | |
1588 | + }, | |
1589 | + "os-tmpdir": { | |
1590 | + "version": "1.0.2", | |
1591 | + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", | |
1592 | + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" | |
1593 | + }, | |
1594 | + "osenv": { | |
1595 | + "version": "0.1.5", | |
1596 | + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", | |
1597 | + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", | |
1598 | + "requires": { | |
1599 | + "os-homedir": "1.0.2", | |
1600 | + "os-tmpdir": "1.0.2" | |
1601 | + } | |
1602 | + }, | |
1305 | 1603 | "p-lazy": { |
1306 | 1604 | "version": "1.0.0", |
1307 | 1605 | "resolved": "https://registry.npmjs.org/p-lazy/-/p-lazy-1.0.0.tgz", |
... | ... | @@ -1404,6 +1702,11 @@ |
1404 | 1702 | "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", |
1405 | 1703 | "integrity": "sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10=" |
1406 | 1704 | }, |
1705 | + "performance-now": { | |
1706 | + "version": "2.1.0", | |
1707 | + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", | |
1708 | + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" | |
1709 | + }, | |
1407 | 1710 | "pinkie": { |
1408 | 1711 | "version": "2.0.4", |
1409 | 1712 | "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", |
... | ... | @@ -1446,6 +1749,11 @@ |
1446 | 1749 | "ipaddr.js": "1.8.0" |
1447 | 1750 | } |
1448 | 1751 | }, |
1752 | + "psl": { | |
1753 | + "version": "1.1.29", | |
1754 | + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", | |
1755 | + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" | |
1756 | + }, | |
1449 | 1757 | "punycode": { |
1450 | 1758 | "version": "1.4.1", |
1451 | 1759 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", |
... | ... | @@ -1482,6 +1790,24 @@ |
1482 | 1790 | "unpipe": "1.0.0" |
1483 | 1791 | } |
1484 | 1792 | }, |
1793 | + "rc": { | |
1794 | + "version": "1.2.8", | |
1795 | + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", | |
1796 | + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", | |
1797 | + "requires": { | |
1798 | + "deep-extend": "0.6.0", | |
1799 | + "ini": "1.3.5", | |
1800 | + "minimist": "1.2.0", | |
1801 | + "strip-json-comments": "2.0.1" | |
1802 | + }, | |
1803 | + "dependencies": { | |
1804 | + "minimist": { | |
1805 | + "version": "1.2.0", | |
1806 | + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", | |
1807 | + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" | |
1808 | + } | |
1809 | + } | |
1810 | + }, | |
1485 | 1811 | "readable-stream": { |
1486 | 1812 | "version": "2.3.6", |
1487 | 1813 | "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", |
... | ... | @@ -1635,6 +1961,11 @@ |
1635 | 1961 | } |
1636 | 1962 | } |
1637 | 1963 | }, |
1964 | + "rotating-file-stream": { | |
1965 | + "version": "1.3.9", | |
1966 | + "resolved": "https://registry.npmjs.org/rotating-file-stream/-/rotating-file-stream-1.3.9.tgz", | |
1967 | + "integrity": "sha512-LQEN1lYP/fOvNsjJsfQUW93cXRxt5Yp0BHVxUhreZAjFRlQ4Hyv7Pt6MKuek8U2ZpKpA8dvKvjzyOapvsRK7Fg==" | |
1968 | + }, | |
1638 | 1969 | "safe-buffer": { |
1639 | 1970 | "version": "5.1.2", |
1640 | 1971 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", |
... | ... | @@ -1701,11 +2032,21 @@ |
1701 | 2032 | "send": "0.16.2" |
1702 | 2033 | } |
1703 | 2034 | }, |
2035 | + "set-blocking": { | |
2036 | + "version": "2.0.0", | |
2037 | + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", | |
2038 | + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" | |
2039 | + }, | |
1704 | 2040 | "setprototypeof": { |
1705 | 2041 | "version": "1.1.0", |
1706 | 2042 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", |
1707 | 2043 | "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" |
1708 | 2044 | }, |
2045 | + "signal-exit": { | |
2046 | + "version": "3.0.2", | |
2047 | + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", | |
2048 | + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" | |
2049 | + }, | |
1709 | 2050 | "simple-swizzle": { |
1710 | 2051 | "version": "0.2.2", |
1711 | 2052 | "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", |
... | ... | @@ -1736,6 +2077,139 @@ |
1736 | 2077 | "memory-pager": "1.1.0" |
1737 | 2078 | } |
1738 | 2079 | }, |
2080 | + "sqlite3": { | |
2081 | + "version": "4.0.2", | |
2082 | + "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-4.0.2.tgz", | |
2083 | + "integrity": "sha512-51ferIRwYOhzUEtogqOa/y9supADlAht98bF/gbIi6WkzRJX6Yioldxbzj1MV4yV+LgdKD/kkHwFTeFXOG4htA==", | |
2084 | + "requires": { | |
2085 | + "nan": "2.10.0", | |
2086 | + "node-pre-gyp": "0.10.3", | |
2087 | + "request": "2.88.0" | |
2088 | + }, | |
2089 | + "dependencies": { | |
2090 | + "assert-plus": { | |
2091 | + "version": "1.0.0", | |
2092 | + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", | |
2093 | + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" | |
2094 | + }, | |
2095 | + "aws-sign2": { | |
2096 | + "version": "0.7.0", | |
2097 | + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", | |
2098 | + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" | |
2099 | + }, | |
2100 | + "caseless": { | |
2101 | + "version": "0.12.0", | |
2102 | + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", | |
2103 | + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" | |
2104 | + }, | |
2105 | + "combined-stream": { | |
2106 | + "version": "1.0.7", | |
2107 | + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", | |
2108 | + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", | |
2109 | + "requires": { | |
2110 | + "delayed-stream": "1.0.0" | |
2111 | + } | |
2112 | + }, | |
2113 | + "delayed-stream": { | |
2114 | + "version": "1.0.0", | |
2115 | + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", | |
2116 | + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" | |
2117 | + }, | |
2118 | + "form-data": { | |
2119 | + "version": "2.3.2", | |
2120 | + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", | |
2121 | + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", | |
2122 | + "requires": { | |
2123 | + "asynckit": "0.4.0", | |
2124 | + "combined-stream": "1.0.6", | |
2125 | + "mime-types": "2.1.20" | |
2126 | + }, | |
2127 | + "dependencies": { | |
2128 | + "combined-stream": { | |
2129 | + "version": "1.0.6", | |
2130 | + "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", | |
2131 | + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", | |
2132 | + "requires": { | |
2133 | + "delayed-stream": "1.0.0" | |
2134 | + } | |
2135 | + } | |
2136 | + } | |
2137 | + }, | |
2138 | + "har-validator": { | |
2139 | + "version": "5.1.0", | |
2140 | + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", | |
2141 | + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", | |
2142 | + "requires": { | |
2143 | + "ajv": "5.5.2", | |
2144 | + "har-schema": "2.0.0" | |
2145 | + } | |
2146 | + }, | |
2147 | + "http-signature": { | |
2148 | + "version": "1.2.0", | |
2149 | + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", | |
2150 | + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", | |
2151 | + "requires": { | |
2152 | + "assert-plus": "1.0.0", | |
2153 | + "jsprim": "1.4.1", | |
2154 | + "sshpk": "1.15.1" | |
2155 | + } | |
2156 | + }, | |
2157 | + "nan": { | |
2158 | + "version": "2.10.0", | |
2159 | + "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", | |
2160 | + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" | |
2161 | + }, | |
2162 | + "oauth-sign": { | |
2163 | + "version": "0.9.0", | |
2164 | + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", | |
2165 | + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" | |
2166 | + }, | |
2167 | + "request": { | |
2168 | + "version": "2.88.0", | |
2169 | + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", | |
2170 | + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", | |
2171 | + "requires": { | |
2172 | + "aws-sign2": "0.7.0", | |
2173 | + "aws4": "1.8.0", | |
2174 | + "caseless": "0.12.0", | |
2175 | + "combined-stream": "1.0.7", | |
2176 | + "extend": "3.0.2", | |
2177 | + "forever-agent": "0.6.1", | |
2178 | + "form-data": "2.3.2", | |
2179 | + "har-validator": "5.1.0", | |
2180 | + "http-signature": "1.2.0", | |
2181 | + "is-typedarray": "1.0.0", | |
2182 | + "isstream": "0.1.2", | |
2183 | + "json-stringify-safe": "5.0.1", | |
2184 | + "mime-types": "2.1.20", | |
2185 | + "oauth-sign": "0.9.0", | |
2186 | + "performance-now": "2.1.0", | |
2187 | + "qs": "6.5.2", | |
2188 | + "safe-buffer": "5.1.2", | |
2189 | + "tough-cookie": "2.4.3", | |
2190 | + "tunnel-agent": "0.6.0", | |
2191 | + "uuid": "3.3.2" | |
2192 | + } | |
2193 | + }, | |
2194 | + "tough-cookie": { | |
2195 | + "version": "2.4.3", | |
2196 | + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", | |
2197 | + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", | |
2198 | + "requires": { | |
2199 | + "psl": "1.1.29", | |
2200 | + "punycode": "1.4.1" | |
2201 | + } | |
2202 | + }, | |
2203 | + "tunnel-agent": { | |
2204 | + "version": "0.6.0", | |
2205 | + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", | |
2206 | + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", | |
2207 | + "requires": { | |
2208 | + "safe-buffer": "5.1.2" | |
2209 | + } | |
2210 | + } | |
2211 | + } | |
2212 | + }, | |
1739 | 2213 | "sshpk": { |
1740 | 2214 | "version": "1.15.1", |
1741 | 2215 | "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", |
... | ... | @@ -1795,6 +2269,16 @@ |
1795 | 2269 | } |
1796 | 2270 | } |
1797 | 2271 | }, |
2272 | + "string-width": { | |
2273 | + "version": "1.0.2", | |
2274 | + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", | |
2275 | + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", | |
2276 | + "requires": { | |
2277 | + "code-point-at": "1.1.0", | |
2278 | + "is-fullwidth-code-point": "1.0.0", | |
2279 | + "strip-ansi": "3.0.1" | |
2280 | + } | |
2281 | + }, | |
1798 | 2282 | "string_decoder": { |
1799 | 2283 | "version": "1.1.1", |
1800 | 2284 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", |
... | ... | @@ -1816,11 +2300,30 @@ |
1816 | 2300 | "ansi-regex": "2.1.1" |
1817 | 2301 | } |
1818 | 2302 | }, |
2303 | + "strip-json-comments": { | |
2304 | + "version": "2.0.1", | |
2305 | + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", | |
2306 | + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" | |
2307 | + }, | |
1819 | 2308 | "supports-color": { |
1820 | 2309 | "version": "2.0.0", |
1821 | 2310 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", |
1822 | 2311 | "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" |
1823 | 2312 | }, |
2313 | + "tar": { | |
2314 | + "version": "4.4.6", | |
2315 | + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.6.tgz", | |
2316 | + "integrity": "sha512-tMkTnh9EdzxyfW+6GK6fCahagXsnYk6kE6S9Gr9pjVdys769+laCTbodXDhPAjzVtEBazRgP0gYqOjnk9dQzLg==", | |
2317 | + "requires": { | |
2318 | + "chownr": "1.1.1", | |
2319 | + "fs-minipass": "1.2.5", | |
2320 | + "minipass": "2.3.4", | |
2321 | + "minizlib": "1.1.1", | |
2322 | + "mkdirp": "0.5.1", | |
2323 | + "safe-buffer": "5.1.2", | |
2324 | + "yallist": "3.0.2" | |
2325 | + } | |
2326 | + }, | |
1824 | 2327 | "text-hex": { |
1825 | 2328 | "version": "1.0.0", |
1826 | 2329 | "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", |
... | ... | @@ -1964,6 +2467,14 @@ |
1964 | 2467 | } |
1965 | 2468 | } |
1966 | 2469 | }, |
2470 | + "wide-align": { | |
2471 | + "version": "1.1.3", | |
2472 | + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", | |
2473 | + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", | |
2474 | + "requires": { | |
2475 | + "string-width": "1.0.2" | |
2476 | + } | |
2477 | + }, | |
1967 | 2478 | "window-size": { |
1968 | 2479 | "version": "0.1.0", |
1969 | 2480 | "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", |
... | ... | @@ -2074,6 +2585,11 @@ |
2074 | 2585 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", |
2075 | 2586 | "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" |
2076 | 2587 | }, |
2588 | + "yallist": { | |
2589 | + "version": "3.0.2", | |
2590 | + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz", | |
2591 | + "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=" | |
2592 | + }, | |
2077 | 2593 | "yargs": { |
2078 | 2594 | "version": "3.10.0", |
2079 | 2595 | "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", | ... | ... |
package.json
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | "dependencies": { |
13 | 13 | "app-module-path": "^2.2.0", |
14 | 14 | "body-parser": "^1.18.3", |
15 | + "commonlog-kb": "^1.3.5", | |
15 | 16 | "connect-flash": "^0.1.1", |
16 | 17 | "connect-redis": "^3.4.0", |
17 | 18 | "cookie-parser": "^1.4.3", |
... | ... | @@ -24,6 +25,7 @@ |
24 | 25 | "mocha": "^5.2.0", |
25 | 26 | "moment": "^2.22.2", |
26 | 27 | "mongodb": "^3.1.8", |
28 | + "morgan": "^1.9.1", | |
27 | 29 | "node-json-config": "0.0.4", |
28 | 30 | "passport": "^0.4.0", |
29 | 31 | "passport-local": "^1.0.0", | ... | ... |
utils/config.js
... | ... | @@ -6,17 +6,17 @@ const NodeJsonConfig = require('node-json-config'); |
6 | 6 | const conf = new NodeJsonConfig('app.config.json'); |
7 | 7 | |
8 | 8 | let defaultConfObj = conf.get('default'); |
9 | -console.log('defaultConfObj'); | |
10 | -console.log(defaultConfObj); | |
9 | +// console.log('defaultConfObj'); | |
10 | +// console.log(defaultConfObj); | |
11 | 11 | |
12 | 12 | let envConfObj = conf.get(nodeEnv); |
13 | -console.log('envConfObj'); | |
14 | -console.log(envConfObj); | |
13 | +// console.log('envConfObj'); | |
14 | +// console.log(envConfObj); | |
15 | 15 | |
16 | 16 | let currentConfObj = Object.assign(defaultConfObj, envConfObj); |
17 | 17 | |
18 | -console.log('currentConfObj'); | |
19 | -console.log(currentConfObj); | |
18 | +// console.log('currentConfObj'); | |
19 | +// console.log(currentConfObj); | |
20 | 20 | |
21 | 21 | conf.put(nodeEnv, currentConfObj); |
22 | 22 | ... | ... |
... | ... | @@ -0,0 +1,90 @@ |
1 | +module.exports = Object.freeze({ | |
2 | + REQUEST: 'Request', | |
3 | + RESPONSE: 'Response', | |
4 | + SUCCESS: 'Success', | |
5 | + ERROR: 'Error', | |
6 | + FAIL: 'Fail', | |
7 | + URLKEYWORD : ["filter","offset","orderby","limit","fields"], | |
8 | + METHOD:{ | |
9 | + GET : 'GET', | |
10 | + POST : 'POST', | |
11 | + PUT : 'PUT', | |
12 | + DELETE : 'DELETE' | |
13 | + }, | |
14 | + RESPONSECONN:{ | |
15 | + STATS:{ | |
16 | + ETIMEDOUT:'ETIMEDOUT', | |
17 | + ECONNREFUSED : 'ECONNREFUSED', | |
18 | + ESOCKETTIMEDOUT : 'ESOCKETTIMEDOUT', | |
19 | + MISSING : 'Missing' | |
20 | + }, | |
21 | + MESSAGE:{ | |
22 | + ETIMEDOUT:{ | |
23 | + resultCode : 'null', | |
24 | + resultDescription : 'Time out' | |
25 | + }, | |
26 | + ECONNREFUSED:{ | |
27 | + resultCode : 'null', | |
28 | + resultDescription : 'Reject' | |
29 | + }, | |
30 | + ESOCKETTIMEDOUT:{ | |
31 | + resultCode : 'null', | |
32 | + resultDescription : 'Time out' | |
33 | + }, | |
34 | + EOTHERERROR:{ | |
35 | + resultCode : 'null', | |
36 | + resultDescription : 'Error' | |
37 | + }, | |
38 | + ERROR:{ | |
39 | + resultCode : '50000', | |
40 | + resultDescription : 'System error' | |
41 | + }, | |
42 | + SUCCESS:{ | |
43 | + resultCode : '20000', | |
44 | + resultDescription : 'Success' | |
45 | + }, | |
46 | + EXCEED:{ | |
47 | + resultCode : '40302', | |
48 | + resultDescription : 'Exceed data allowances' | |
49 | + }, | |
50 | + DBERROR:{ | |
51 | + resultCode : '50001', | |
52 | + resultDescription : 'Database error' | |
53 | + }, | |
54 | + SUCCESSWITHCON:{ | |
55 | + resultCode : '20001', | |
56 | + resultDescription : 'Success with condition' | |
57 | + } | |
58 | + } | |
59 | + }, | |
60 | + RESPONSERESULT:{ | |
61 | + SUCCESS:{ | |
62 | + resultCode : '20000', | |
63 | + developerMessage : 'Success' | |
64 | + }, | |
65 | + MISSING_INVALID:{ | |
66 | + resultCode : '40300', | |
67 | + developerMessage : 'Missing or invalid parameter' | |
68 | + }, | |
69 | + DATA_NOT_FOUND:{ | |
70 | + resultCode : '40401', | |
71 | + developerMessage : 'Data Not Found' | |
72 | + }, | |
73 | + DATA_EXIST:{ | |
74 | + resultCode : '40301', | |
75 | + developerMessage : 'Data Exist' | |
76 | + }, | |
77 | + ERROR:{ | |
78 | + resultCode : '50000', | |
79 | + developerMessage : 'System error' | |
80 | + }, | |
81 | + DENIED:{ | |
82 | + resultCode : '40100', | |
83 | + developerMessage : 'Access Denied' | |
84 | + }, | |
85 | + UNKNOW:{ | |
86 | + resultCode : '40400', | |
87 | + developerMessage : 'Unknown URL' | |
88 | + } | |
89 | + } | |
90 | +}); | |
0 | 91 | \ No newline at end of file | ... | ... |
utils/errors.js
... | ... | @@ -1,16 +0,0 @@ |
1 | -class ValidationError extends Error { | |
2 | - constructor(err, ...params) { | |
3 | - super(...params); | |
4 | - this.instance = err; | |
5 | - } | |
6 | -} | |
7 | - | |
8 | -class UnirestError extends Error { | |
9 | - constructor(err, ...params) { | |
10 | - super(...params); | |
11 | - this.instance = err; | |
12 | - } | |
13 | -} | |
14 | - | |
15 | -module.exports.ValidationError = ValidationError; | |
16 | -module.exports.UnirestError = UnirestError; | |
17 | 0 | \ No newline at end of file |
... | ... | @@ -0,0 +1,264 @@ |
1 | +const os = require("os"); | |
2 | +var cfg = require('./config'); | |
3 | +var utils = require('./utils'); | |
4 | +var conf = cfg.get("configlog"); | |
5 | +conf.projectName = cfg.get("appName"); | |
6 | +var logg = require('commonlog-kb'); | |
7 | +var constants = require('./constants'); | |
8 | + | |
9 | +var log4js = require('log4js'); | |
10 | +var appenders = {}; | |
11 | +appenders[conf.projectName] = { type: 'file', filename: conf.detail.path+"/"+os.hostname() + '_'+conf.projectName+'.detail' }; | |
12 | +log4js.configure({ | |
13 | + appenders: appenders , | |
14 | + categories: { default: { appenders: [conf.projectName], level: 'info' } } | |
15 | + }); | |
16 | + | |
17 | +var logger4jDetail = log4js.getLogger(conf.projectName); | |
18 | +var logger = []; | |
19 | + | |
20 | +var mapLog = {}; | |
21 | + | |
22 | +logger.startlog = function (req,cmdData,session,identity) | |
23 | +{ | |
24 | + | |
25 | + | |
26 | + var start = { | |
27 | + session : utils.undefinedToNull(session), | |
28 | + cmd : cmdData, | |
29 | + identity : utils.undefinedToNull(identity) | |
30 | + }; | |
31 | + | |
32 | + mapLog[req.id].start = start; | |
33 | +} | |
34 | + | |
35 | +logger.stat = function (msg){ | |
36 | + logg.stat(msg); | |
37 | +} | |
38 | + | |
39 | +logger.log = function (msg,type) | |
40 | +{ | |
41 | + | |
42 | + if(!type) | |
43 | + type = 'debug'; | |
44 | + | |
45 | + type = type.toLowerCase(); | |
46 | + | |
47 | + switch(type) { | |
48 | + case 'debug': | |
49 | + logg.debug(msg); | |
50 | + break; | |
51 | + case 'info': | |
52 | + logg.info(msg); | |
53 | + break; | |
54 | + case 'warn': | |
55 | + logg.warn(msg); | |
56 | + break; | |
57 | + case 'error': | |
58 | + logg.error(msg); | |
59 | + break; | |
60 | + default: | |
61 | + logg.debug(msg); | |
62 | + } | |
63 | + | |
64 | + console.log(msg); | |
65 | +} | |
66 | + | |
67 | +logger.addSuccessSummary = function (req,nodeData,cmdData,result) | |
68 | +{ | |
69 | + summary = { | |
70 | + node : utils.undefinedToNull(nodeData), | |
71 | + cmd : cmdData, | |
72 | + resultCode : result.resultCode, | |
73 | + resultDescription : result.resultDescription, | |
74 | + type : constants.SUCCESS | |
75 | + }; | |
76 | + mapLog[req.id].summaryList.push(summary); | |
77 | +} | |
78 | + | |
79 | +logger.addErrorSummary = function (req,nodeData,cmdData,result) | |
80 | +{ | |
81 | + summary = { | |
82 | + node : utils.undefinedToNull(nodeData), | |
83 | + cmd : cmdData, | |
84 | + resultCode : result.resultCode, | |
85 | + resultDescription : result.resultDescription, | |
86 | + type : constants.ERROR | |
87 | + }; | |
88 | + | |
89 | + mapLog[req.id].summaryList.push(summary); | |
90 | +} | |
91 | + | |
92 | +logger.logSummary = function (req,response) | |
93 | +{ | |
94 | + | |
95 | + var start = mapLog[req.id].start; | |
96 | + var summaryList = mapLog[req.id].summaryList; | |
97 | + | |
98 | + var log = logg.summary(start.session,start.cmd,start.identity); | |
99 | + var row; | |
100 | + for (let index = 0; index < summaryList.length; index++) { | |
101 | + row = summaryList[index]; | |
102 | + if(row.type === constants.SUCCESS){ | |
103 | + log.addSuccessBlock(row.node,row.cmd,row.resultCode,row.resultDescription); | |
104 | + } else { | |
105 | + log.addErrorBlock(row.node,row.cmd,utils.undefinedToNull(row.resultCode),utils.undefinedToNull(row.resultDescription)); | |
106 | + } | |
107 | + } | |
108 | + | |
109 | + if(response){ | |
110 | + log.end(response.resultCode,response.resultDescription) | |
111 | + } else { | |
112 | + log.end() | |
113 | + } | |
114 | +} | |
115 | + | |
116 | +logger.startEC = function(req) | |
117 | +{ | |
118 | + var objectLog = { | |
119 | + summaryList : [], | |
120 | + start : {}, | |
121 | + detail : {}, | |
122 | + startTime : new Date() | |
123 | + } | |
124 | + | |
125 | + | |
126 | + mapLog[req.id] = objectLog; | |
127 | + | |
128 | + var newLine = "\r\n"; | |
129 | + var messageRes = ''; | |
130 | + var startTime = mapLog[req.id].startTime; | |
131 | + | |
132 | + | |
133 | + if(req.body) | |
134 | + { | |
135 | + if(typeof req.body === 'string') | |
136 | + body = req.bod; | |
137 | + else | |
138 | + body = JSON.stringify(req.body); | |
139 | + } | |
140 | + | |
141 | + var header = ""; | |
142 | + if(req.headers) | |
143 | + { | |
144 | + if(typeof req.headers === 'string') | |
145 | + header = req.headers; | |
146 | + else | |
147 | + header = JSON.stringify(req.headers); | |
148 | + } | |
149 | + | |
150 | + messageRes += newLine+newLine+"#====> Incoming Message <====# "; | |
151 | + messageRes += newLine+"Session : "+req.id; | |
152 | + messageRes += newLine+"Url : "+req.url; | |
153 | + messageRes += newLine+"Method : "+req.method; | |
154 | + messageRes += newLine+"Header : "+header; | |
155 | + messageRes += newLine+"Body : "+body; | |
156 | + messageRes += newLine+"Time in : "+startTime.toISOString(); | |
157 | + messageRes += newLine | |
158 | + | |
159 | + logg.debug(messageRes); | |
160 | +} | |
161 | + | |
162 | +logger.endEC = function(req,res) | |
163 | +{ | |
164 | + | |
165 | + var newLine = "\r\n"; | |
166 | + var messageRes = ''; | |
167 | + var startTime = mapLog[req.id].startTime; | |
168 | + var endTime = new Date(); | |
169 | + | |
170 | + var body = ""; | |
171 | + if(res.resBody) | |
172 | + { | |
173 | + if(typeof res.resBody === 'string') | |
174 | + body = res.resBody; | |
175 | + else | |
176 | + body = JSON.stringify(res.resBody); | |
177 | + } | |
178 | + | |
179 | + var header = ""; | |
180 | + if(res.req.headers) | |
181 | + { | |
182 | + if(typeof res.req.headers === 'string') | |
183 | + header = res.req.headers; | |
184 | + else | |
185 | + header = JSON.stringify(res.req.headers); | |
186 | + } | |
187 | + | |
188 | + messageRes += newLine+newLine+"#====> Outgoing Message <====# "; | |
189 | + messageRes += newLine+"Session : "+req.id; | |
190 | + messageRes += newLine+"Header : "+header; | |
191 | + messageRes += newLine+"Body : "+body; | |
192 | + messageRes += newLine+"Time out : "+endTime.toISOString(); | |
193 | + messageRes += newLine+"Use times : "+Math.abs(endTime - startTime)+" ms"; | |
194 | + | |
195 | + | |
196 | + | |
197 | + | |
198 | + logg.debug(messageRes); | |
199 | + messageRes += newLine | |
200 | +} | |
201 | + | |
202 | +//detail | |
203 | +logger.detailRequestFE = function(req) | |
204 | +{ | |
205 | + // console.log(req); | |
206 | + var protocal = "HTTP"; | |
207 | + var method = req.method; | |
208 | + var url = req.headers.host+req.originalUrl; | |
209 | + var body = JSON.stringify(req.body); | |
210 | + logger4jDetail.info(logPrefix(req)+protocal+" "+method+" "+url+" Request from FE - body: "+body); | |
211 | + | |
212 | +} | |
213 | + | |
214 | +logger.detailResponseFE = function(req) | |
215 | +{ | |
216 | + var protocal = "HTTP"; | |
217 | + var method = req.method; | |
218 | + var url = req.headers.host+req.originalUrl; | |
219 | + var body = JSON.stringify(req.body); | |
220 | + logger4jDetail.info(logPrefix(req)+protocal+" "+method+" "+url+" Response to FE - body: "+body); | |
221 | +} | |
222 | + | |
223 | +logger.detailSqlQuery = function(req,method,data) | |
224 | +{ | |
225 | + logger4jDetail.info(logPrefix(req)+method+": "+JSON.stringify(data)); | |
226 | +} | |
227 | + | |
228 | +logger.detailSqlResult = function(req,method,data) | |
229 | +{ | |
230 | + logger4jDetail.info(logPrefix(req)+method+": "+JSON.stringify(data)); | |
231 | +} | |
232 | + | |
233 | +logger.detailRequestBE = function(req,data) | |
234 | +{ | |
235 | + var protocal = data.protocal; | |
236 | + var method = data.method; | |
237 | + var url = data.url; | |
238 | + var header = JSON.stringify(data.header); | |
239 | + var body = JSON.stringify(data.body); | |
240 | + logger4jDetail.info(logPrefix(req)+"BE Send "+protocal+" "+method+" "+url+" request-header: "+header+" request-body:"+body); | |
241 | +} | |
242 | + | |
243 | +logger.detailResponseBE = function(req,data) | |
244 | +{ | |
245 | + var protocal = data.protocal; | |
246 | + var method = data.method; | |
247 | + var url = data.url; | |
248 | + var header = JSON.stringify(data.header); | |
249 | + var body = JSON.stringify(data.body); | |
250 | + logger4jDetail.info(logPrefix(req)+"BE Receive "+protocal+" "+method+" "+url+" response-header: "+header+" response-body:"+body); | |
251 | +} | |
252 | + | |
253 | +function logPrefix(req) | |
254 | +{ | |
255 | + | |
256 | + var userName = "userName"; | |
257 | + var sessionID = "sessionID"; | |
258 | + var session = "session"; | |
259 | + | |
260 | + return ":: ## "+userName+" - "+sessionID+" - "+session+ " ## "; | |
261 | + | |
262 | +} | |
263 | + | |
264 | +module.exports = logger; | ... | ... |
utils/mongoDB.js
1 | -const logger = require('./request-logger'); | |
1 | +const log = require('./log'); | |
2 | +var constants = require('./constants'); | |
2 | 3 | var MongoClient = require('mongodb').MongoClient; |
3 | 4 | var config = require('./config'); |
4 | 5 | |
... | ... | @@ -16,93 +17,82 @@ connection.reqMongo = async function (req,method, query, collection) { |
16 | 17 | |
17 | 18 | |
18 | 19 | function mongoReq(req,url,database,method, query, collection){ |
19 | - | |
20 | - logger.logSqlQuery({id : "session", reqId : req.id}, query); | |
20 | + | |
21 | + var nodeName = "MongoDB"; | |
22 | + var funStats = { | |
23 | + detailSqlQuery : function(query){log.detailSqlQuery(req,method,query);}, | |
24 | + detailSqlResult : function(result, err){log.detailSqlResult(req,method,result || err);}, | |
25 | + addSuccessSummary : function(result){log.addSuccessSummary(req,nodeName,collection,result);}, | |
26 | + addErrorSummary : function(result){log.addErrorSummary(req,nodeName,collection,result);} | |
27 | + }; | |
28 | + | |
29 | + | |
21 | 30 | |
22 | 31 | return new Promise((resolve, reject) => { |
23 | 32 | MongoClient.connect(url, { useNewUrlParser: true }, function(err, db) { |
24 | 33 | if (err) { |
25 | - console.log(err) | |
26 | - logger.logSqlResult({id : "session", reqId : req.id}, err.errmsg); | |
27 | - resolve({ | |
28 | - resultCode : "50001", | |
29 | - message : err.errmsg | |
30 | - }); | |
34 | + console.log(err) | |
35 | + resolve(constants.RESPONSECONN.MESSAGE.DBERROR); | |
31 | 36 | } |
32 | - | |
37 | + funStats.detailSqlQuery(query); | |
38 | + var dbInstant = db.db(database).collection(collection); | |
33 | 39 | switch (method) { |
34 | - case "GET": | |
35 | - db.db(database).collection(collection).find(query, { projection: { _id: 0 } }).toArray(function(err, result) { | |
36 | - db.close(); | |
37 | - | |
38 | - if (err) { | |
39 | - console.log(err) | |
40 | - resolve(checkResponse(req,{err:err})); | |
41 | - }else | |
42 | - resolve(checkResponse(req,result)); | |
40 | + case constants.METHOD.GET: | |
41 | + dbInstant.find(query, { projection: { _id: 0 } }).toArray(function(err, result) { | |
42 | + resolve(checkResponse(result,err,funStats)); | |
43 | 43 | }); |
44 | 44 | break; |
45 | - case "POST": | |
46 | - db.db(database).collection(collection).find(query, { projection: { _id: 0 } }).toArray(function(err, result) { | |
47 | - db.close(); | |
48 | - | |
49 | - if (err) { | |
50 | - console.log(err) | |
51 | - resolve(checkResponse(req,{err:err})); | |
52 | - }else | |
53 | - resolve(checkResponse(req,result)); | |
45 | + case constants.METHOD.POST: | |
46 | + db.db(database).collection(collection).insertOne(query, function(err, result) { | |
47 | + var response = checkResponse(result,err,funStats); | |
48 | + delete response.resultData; | |
49 | + resolve(response); | |
54 | 50 | }); |
55 | 51 | break; |
56 | 52 | case "PUT": |
57 | - db.db(database).collection(collection).find(query, { projection: { _id: 0 } }).toArray(function(err, result) { | |
58 | - db.close(); | |
53 | + // db.db(database).collection(collection).find(query, { projection: { _id: 0 } }).toArray(function(err, result) { | |
54 | + // db.close(); | |
59 | 55 | |
60 | - if (err) { | |
61 | - console.log(err) | |
62 | - resolve(checkResponse(req,{err:err})); | |
63 | - }else | |
64 | - resolve(checkResponse(req,result)); | |
65 | - }); | |
56 | + // if (err) { | |
57 | + // console.log(err) | |
58 | + // resolve(checkResponse(req,{err:err})); | |
59 | + // }else | |
60 | + // resolve(checkResponse(req,result)); | |
61 | + // }); | |
66 | 62 | break; |
67 | 63 | case "DELETE": |
68 | - db.db(database).collection(collection).find(query, { projection: { _id: 0 } }).toArray(function(err, result) { | |
69 | - db.close(); | |
64 | + // db.db(database).collection(collection).find(query, { projection: { _id: 0 } }).toArray(function(err, result) { | |
65 | + // db.close(); | |
70 | 66 | |
71 | - if (err) { | |
72 | - console.log(err) | |
73 | - resolve(checkResponse(req,{err:err})); | |
74 | - }else | |
75 | - resolve(checkResponse(req,result)); | |
76 | - }); | |
67 | + // if (err) { | |
68 | + // console.log(err) | |
69 | + // resolve(checkResponse(req,{err:err})); | |
70 | + // }else | |
71 | + // resolve(checkResponse(req,result)); | |
72 | + // }); | |
77 | 73 | break; |
78 | 74 | |
79 | 75 | } |
80 | - | |
81 | - | |
76 | + db.close(); | |
82 | 77 | }); |
83 | 78 | }); |
84 | 79 | |
85 | 80 | } |
86 | 81 | |
87 | -function checkResponse(req,response) | |
88 | -{ | |
89 | - | |
90 | - | |
91 | - if(response.err) | |
92 | - { | |
93 | - logger.logSqlResult({id : "session", reqId : req.id}, err.errmsg); | |
94 | - var returnData = { | |
95 | - resultCode : "50001", | |
96 | - message : response.err.errmsg | |
97 | - }; | |
98 | - }else | |
82 | +function checkResponse(result,err,funStats) | |
83 | +{ | |
84 | + | |
85 | + funStats.detailSqlResult(result, err); | |
86 | + if(err) | |
99 | 87 | { |
100 | - logger.logSqlResult({id : "session", reqId : req.id}, response); | |
101 | - var returnData = { | |
102 | - resultCode : "20000", | |
103 | - resultDescription : "Success", | |
104 | - resultData : response | |
105 | - }; | |
88 | + var returnData = constants.RESPONSECONN.MESSAGE.DBERROR; | |
89 | + funStats.addErrorSummary(returnData); | |
90 | + } | |
91 | + else | |
92 | + { | |
93 | + var returnData = constants.RESPONSECONN.MESSAGE.SUCCESS; | |
94 | + returnData.resultData = result; | |
95 | + funStats.addSuccessSummary(returnData); | |
106 | 96 | } |
107 | 97 | |
108 | 98 | return returnData | ... | ... |
utils/passport-func.js
... | ... | @@ -1,71 +0,0 @@ |
1 | -const passport = require('passport'); | |
2 | -const LocalStrategy = require('passport-local').Strategy; | |
3 | -const SamlStrategy = require('passport-saml').Strategy; | |
4 | -const conf = require('utils/config'); | |
5 | - | |
6 | -const passportFunctionLocal = function (username, password, done) { | |
7 | - console.log('checking username and password...'); | |
8 | - if (username === 'admin' && password === 'passw0rd') { | |
9 | - const user = { | |
10 | - id: 1, | |
11 | - username: username | |
12 | - }; | |
13 | - console.log('checking username and password... Passed'); | |
14 | - return done(null, user); | |
15 | - } else { | |
16 | - console.log('checking username and password... Failed'); | |
17 | - return done(null, false, {message: 'Incorrect credentials'}); | |
18 | - } | |
19 | -}; | |
20 | - | |
21 | -const passportFunctionSaml = function(profile, done) { | |
22 | - return done(null, | |
23 | - { | |
24 | - userName: profile.userName, | |
25 | - email: profile.email, | |
26 | - firstName: profile.firstName, | |
27 | - lastName: profile.lastName, | |
28 | - fullName: profile.fullName | |
29 | - }); | |
30 | -}; | |
31 | - | |
32 | -module.exports = function() { | |
33 | - | |
34 | - passport.serializeUser(function(user, done) { | |
35 | - console.log('serialize'); | |
36 | - done(null, user); | |
37 | - }); | |
38 | - | |
39 | - passport.deserializeUser(function(user, done) { | |
40 | - console.log('deserialize'); | |
41 | - done(null, user); | |
42 | - }); | |
43 | - | |
44 | - let PassportStrategy, passportConfig, passportFunction; | |
45 | - switch(conf.get('passport.strategy')) { | |
46 | - case "local": | |
47 | - PassportStrategy = LocalStrategy; | |
48 | - passportConfig = conf.get('passport.configStrategy.local'); | |
49 | - passportFunction = passportFunctionLocal; | |
50 | - break; | |
51 | - case "saml": | |
52 | - PassportStrategy = SamlStrategy; | |
53 | - passportConfig = conf.get('passport.configStrategy.saml'); | |
54 | - passportFunction = passportFunctionSaml; | |
55 | - break; | |
56 | - default: | |
57 | - PassportStrategy = null; | |
58 | - break; | |
59 | - } | |
60 | - | |
61 | - if (PassportStrategy) { | |
62 | - console.log('setup passport strategy'); | |
63 | - console.log(conf.get('passport.strategy')); | |
64 | - console.log(passportConfig); | |
65 | - console.log(passportFunction); | |
66 | - console.log(PassportStrategy); | |
67 | - passport.use(new PassportStrategy(passportConfig, passportFunction)); | |
68 | - } | |
69 | - | |
70 | - return passport; | |
71 | -}; | |
72 | 0 | \ No newline at end of file |
utils/request-logger.js
... | ... | @@ -1,67 +0,0 @@ |
1 | -const winston = require('winston'); | |
2 | -const fs = require('fs'); | |
3 | -const moment = require('moment'); | |
4 | - | |
5 | -let logDir = 'logs'; // directory path you want to set | |
6 | -if ( !fs.existsSync( logDir ) ) { | |
7 | - // Create the directory if it does not exist | |
8 | - fs.mkdirSync( logDir ); | |
9 | -} | |
10 | - | |
11 | -function RequestLogger() { | |
12 | - this.fileTransport = new winston.transports.File({ | |
13 | - timestamp: function() { | |
14 | - return moment().format('YYYY-MM-DDTHH:mm:ss.SSS'); | |
15 | - }, | |
16 | - json: false, | |
17 | - filename: 'logs/app.log', | |
18 | - maxsize: 10240000, | |
19 | - maxFiles: 99, | |
20 | - tailable: true | |
21 | - }); | |
22 | - | |
23 | - this.logger = winston.createLogger({ | |
24 | - transports: [this.fileTransport] | |
25 | - }); | |
26 | - | |
27 | - this.logPrefix = function(session) { | |
28 | - let userId = ''; | |
29 | - let sessionId = session.id || ''; | |
30 | - let reqId = session.reqId || ''; | |
31 | - let msg = `phoenix-partner - :: ## ${userId} - ${sessionId} - ${reqId} ## `; | |
32 | - return msg; | |
33 | - }; | |
34 | -} | |
35 | - | |
36 | -RequestLogger.prototype.logRequest = function(reqMethod, reqUrl, session, data, header) { | |
37 | - header = JSON.stringify(header); | |
38 | - data = JSON.stringify(data); | |
39 | - let msg = this.logPrefix(session) + `BE Send HTTP ${reqMethod} ${reqUrl} request-header: ${header} request-body: ${data}`; | |
40 | - this.logger.info(msg); | |
41 | -}; | |
42 | - | |
43 | -RequestLogger.prototype.logResponse = function(reqMethod, reqUrl, session, data, header) { | |
44 | - header = JSON.stringify(header); | |
45 | - data = JSON.stringify(data); | |
46 | - let msg = this.logPrefix(session) + `BE Receive HTTP ${reqMethod} ${reqUrl} response-header: ${header} response-body: ${data}`; | |
47 | - this.logger.info(msg); | |
48 | -}; | |
49 | - | |
50 | -RequestLogger.prototype.logSqlQuery = function(session, data) { | |
51 | - data = JSON.stringify(data); | |
52 | - let msg = this.logPrefix(session) + `BE Send SQL Query: ${data}`; | |
53 | - this.logger.info(msg); | |
54 | -}; | |
55 | - | |
56 | -RequestLogger.prototype.logSqlResult = function(session, data) { | |
57 | - data = JSON.stringify(data); | |
58 | - let msg = this.logPrefix(session) + `BE Receive SQL Result: ${data}`; | |
59 | - this.logger.info(msg); | |
60 | -}; | |
61 | - | |
62 | -RequestLogger.prototype.debug = function(msg) { | |
63 | - msg = this.logPrefix(session) + ' ' + msg; | |
64 | - this.logger.debug(msg); | |
65 | -}; | |
66 | - | |
67 | -module.exports = new RequestLogger(); | |
68 | 0 | \ No newline at end of file |
utils/send-response.js
1 | -const ValidationError = require('utils/errors').ValidationError; | |
2 | -const UnirestError = require('utils/errors').UnirestError; | |
3 | 1 | |
4 | 2 | let sendResponse = {}; |
5 | 3 | |
... | ... | @@ -13,26 +11,26 @@ sendResponse.missingOrInvalidResponse = (param) => { |
13 | 11 | }; |
14 | 12 | |
15 | 13 | |
16 | -sendResponse.handleError = function(error) { | |
17 | - console.log('catch ' + error); | |
18 | - let errResponse = {}; | |
19 | - if (error instanceof ValidationError) { | |
20 | - errResponse = { | |
21 | - code: 403, | |
22 | - object: this.missingOrInvalidResponse(error.instance[0].message) | |
23 | - }; | |
24 | - } else if (error instanceof UnirestError) { | |
25 | - errResponse = { | |
26 | - code: 500, | |
27 | - object: error.instance | |
28 | - }; | |
29 | - } else { | |
30 | - errResponse = { | |
31 | - code: 500, | |
32 | - object: { message: "System Error" } | |
33 | - }; | |
34 | - } | |
35 | - return errResponse; | |
36 | -}; | |
14 | +// sendResponse.handleError = function(error) { | |
15 | +// console.log('catch ' + error); | |
16 | +// let errResponse = {}; | |
17 | +// if (error instanceof ValidationError) { | |
18 | +// errResponse = { | |
19 | +// code: 403, | |
20 | +// object: this.missingOrInvalidResponse(error.instance[0].message) | |
21 | +// }; | |
22 | +// } else if (error instanceof UnirestError) { | |
23 | +// errResponse = { | |
24 | +// code: 500, | |
25 | +// object: error.instance | |
26 | +// }; | |
27 | +// } else { | |
28 | +// errResponse = { | |
29 | +// code: 500, | |
30 | +// object: { message: "System Error" } | |
31 | +// }; | |
32 | +// } | |
33 | +// return errResponse; | |
34 | +// }; | |
37 | 35 | |
38 | 36 | module.exports = sendResponse; | ... | ... |
... | ... | @@ -0,0 +1,41 @@ |
1 | +var config = require('./config'); | |
2 | +var log = require('./log.js'); | |
3 | +var constants = require('./constants.js'); | |
4 | + | |
5 | +var nodeName = config.get("appName"); | |
6 | +var stat = []; | |
7 | + | |
8 | + | |
9 | +//client and Node | |
10 | +stat.receiveRequest = function (method,cmd,from){ | |
11 | + writeStats(nodeName+" receive "+method+" "+cmd+" request from "+(from?from:"Client")); | |
12 | +}; | |
13 | + | |
14 | +stat.sendResponse = function (method,cmd,to){ | |
15 | + writeStats(nodeName+" send "+method+" "+cmd+" response to "+(to?to:"Client")); | |
16 | +}; | |
17 | + | |
18 | +//node and mongo | |
19 | +stat.sendQuery = function (cmd,to){ | |
20 | + writeStats(nodeName+" send QUERY "+cmd+" request to "+(to?to:"MongoDB")); | |
21 | +}; | |
22 | + | |
23 | +stat.receiveQuery = function (cmd,from){ | |
24 | + writeStats(nodeName+" receive QUERY "+cmd+" response from "+(from?from:"MongoDB")); | |
25 | +}; | |
26 | + | |
27 | +//unknow | |
28 | +stat.receiveUnknow = function(message){ | |
29 | + writeStats(nodeName+" Receive "+message+" "+constants.REQUEST); | |
30 | +}; | |
31 | + | |
32 | +stat.sendUnknow = function(message){ | |
33 | + writeStats(nodeName+" Send "+message); | |
34 | +}; | |
35 | + | |
36 | +function writeStats(string) { | |
37 | + log.log(string); | |
38 | + log.stat(string); | |
39 | +} | |
40 | + | |
41 | +module.exports = stat; | |
0 | 42 | \ No newline at end of file | ... | ... |
utils/utils.js
... | ... | @@ -59,8 +59,13 @@ utils.getUpdateFilter = function(obj) |
59 | 59 | |
60 | 60 | utils.getQueryFilter = async function(data) |
61 | 61 | { |
62 | - var filter = parseFilter(data); | |
63 | - return getQuery(filter); | |
62 | + if(data) | |
63 | + { | |
64 | + var filter = parseFilter(data); | |
65 | + return getQuery(filter); | |
66 | + }else | |
67 | + return {}; | |
68 | + | |
64 | 69 | } |
65 | 70 | |
66 | 71 | getQuery = async function(data,query){ |
... | ... | @@ -178,4 +183,17 @@ function findValueInBracket(data) |
178 | 183 | |
179 | 184 | } |
180 | 185 | |
186 | +utils.undefinedToNull = function(data){ | |
187 | + if(!data){ | |
188 | + data = 'null'; | |
189 | + } else if(data.includes('undefined')){ | |
190 | + data = data.replace(/undefined/g,'null'); | |
191 | + } else { | |
192 | + data = data; | |
193 | + } | |
194 | + | |
195 | + return data; | |
196 | +} | |
197 | + | |
198 | + | |
181 | 199 | module.exports = utils; |
182 | 200 | \ No newline at end of file | ... | ... |
utils/validator.js
... | ... | @@ -1,11 +0,0 @@ |
1 | -const indicative = require('indicative'); | |
2 | -const ValidationError = require('utils/errors').ValidationError; | |
3 | - | |
4 | - | |
5 | -module.exports = function(data, rules) { | |
6 | - return indicative.validate(data, rules) | |
7 | - .catch((err) => { | |
8 | - return Promise.reject(new ValidationError(err)); | |
9 | - } | |
10 | - ) | |
11 | -}; | |
12 | 0 | \ No newline at end of file |
utils/winston-express-middleware/index.js
... | ... | @@ -1,305 +0,0 @@ |
1 | -// Copyright (c) 2012-2014 Heapsource.com and Contributors - http://www.heapsource.com | |
2 | -// | |
3 | -// Permission is hereby granted, free of charge, to any person obtaining a copy | |
4 | -// of this software and associated documentation files (the "Software"), to deal | |
5 | -// in the Software without restriction, including without limitation the rights | |
6 | -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
7 | -// copies of the Software, and to permit persons to whom the Software is | |
8 | -// furnished to do so, subject to the following conditions: | |
9 | -// | |
10 | -// The above copyright notice and this permission notice shall be included in | |
11 | -// all copies or substantial portions of the Software. | |
12 | -// | |
13 | -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
14 | -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
15 | -// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | |
16 | -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
17 | -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
18 | -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
19 | -// THE SOFTWARE. | |
20 | -// | |
21 | -var winston = require('winston'); | |
22 | -var util = require('util'); | |
23 | -var chalk = require('chalk'); | |
24 | - | |
25 | -//Allow this file to get an exclusive copy of underscore so it can change the template settings without affecting others | |
26 | -delete require.cache[require.resolve('lodash')]; | |
27 | -var _ = require('lodash'); | |
28 | -delete require.cache[require.resolve('lodash')]; | |
29 | - | |
30 | -/** | |
31 | - * A default list of properties in the request object that are allowed to be logged. | |
32 | - * These properties will be safely included in the meta of the log. | |
33 | - * 'body' is not included in this list because it can contains passwords and stuff that are sensitive for logging. | |
34 | - * TODO: Include 'body' and get the defaultRequestFilter to filter the inner properties like 'password' or 'password_confirmation', etc. Pull requests anyone? | |
35 | - * @type {Array} | |
36 | - */ | |
37 | -var requestWhitelist = ['url', 'headers', 'method', 'httpVersion', 'originalUrl', 'query']; | |
38 | - | |
39 | -/** | |
40 | - * A default list of properties in the request body that are allowed to be logged. | |
41 | - * This will normally be empty here, since it should be done at the route level. | |
42 | - * @type {Array} | |
43 | - */ | |
44 | -var bodyWhitelist = []; | |
45 | - | |
46 | -/** | |
47 | - * A default list of properties in the request body that are not allowed to be logged. | |
48 | - * @type {Array} | |
49 | - */ | |
50 | -var bodyBlacklist = []; | |
51 | - | |
52 | -/** | |
53 | - * A default list of properties in the response object that are allowed to be logged. | |
54 | - * These properties will be safely included in the meta of the log. | |
55 | - * @type {Array} | |
56 | - */ | |
57 | -var responseWhitelist = ['statusCode']; | |
58 | - | |
59 | -/** | |
60 | - * A list of request routes that will be skipped instead of being logged. This would be useful if routes for health checks or pings would otherwise pollute | |
61 | - * your log files. | |
62 | - * @type {Array} | |
63 | - */ | |
64 | -var ignoredRoutes = []; | |
65 | - | |
66 | -/** | |
67 | - * A default function to filter the properties of the req object. | |
68 | - * @param req | |
69 | - * @param propName | |
70 | - * @return {*} | |
71 | - */ | |
72 | -var defaultRequestFilter = function (req, propName) { | |
73 | - return _.result(req, propName); | |
74 | -}; | |
75 | - | |
76 | -/** | |
77 | - * A default function to filter the properties of the res object. | |
78 | - * @param res | |
79 | - * @param propName | |
80 | - * @return {*} | |
81 | - */ | |
82 | -var defaultResponseFilter = function (res, propName) { | |
83 | - return _.result(res, propName); | |
84 | -}; | |
85 | - | |
86 | -/** | |
87 | - * A default function to decide whether skip logging of particular request. Doesn't skip anything (i.e. log all requests). | |
88 | - * @return always false | |
89 | - */ | |
90 | -var defaultSkip = function() { | |
91 | - return false; | |
92 | -}; | |
93 | - | |
94 | -function filterObject(originalObj, whiteList, initialFilter) { | |
95 | - var obj = {}; | |
96 | - var fieldsSet = false; | |
97 | - | |
98 | - [].concat(whiteList).forEach(function (propName) { | |
99 | - var value = initialFilter(originalObj, propName); | |
100 | - | |
101 | - if(typeof (value) !== 'undefined') { | |
102 | - _.set(obj, propName, value); | |
103 | - fieldsSet = true; | |
104 | - }; | |
105 | - }); | |
106 | - | |
107 | - return fieldsSet ? obj : undefined; | |
108 | -} | |
109 | - | |
110 | -// | |
111 | -// ### function errorLogger(options) | |
112 | -// #### @options {Object} options to initialize the middleware. | |
113 | -// | |
114 | - | |
115 | - | |
116 | -function errorLogger(options) { | |
117 | - | |
118 | - ensureValidOptions(options); | |
119 | - | |
120 | - options.requestFilter = options.requestFilter || defaultRequestFilter; | |
121 | - options.responseFilter = options.responseFilter || defaultResponseFilter; | |
122 | - options.winstonInstance = options.winstonInstance || (new winston.Logger ({ transports: options.transports })); | |
123 | - | |
124 | - return function (err, req, res, next) { | |
125 | - | |
126 | - // Let winston gather all the error data. | |
127 | - var exceptionMeta = winston.exception.getAllInfo(err); | |
128 | - exceptionMeta.req = filterObject(req, requestWhitelist, options.requestFilter); | |
129 | - var end = res.end; | |
130 | - res.end = function(chunk, encoding) { | |
131 | - res.end = end; | |
132 | - res.end(chunk, encoding); | |
133 | - | |
134 | - exceptionMeta.res = filterObject(res, responseWhitelist, options.responseFilter); | |
135 | - // This is fire and forget, we don't want logging to hold up the request so don't wait for the callback | |
136 | - options.winstonInstance.log('error', 'middlewareError', exceptionMeta); | |
137 | - } | |
138 | - | |
139 | - next(err); | |
140 | - }; | |
141 | -} | |
142 | - | |
143 | -// | |
144 | -// ### function logger(options) | |
145 | -// #### @options {Object} options to initialize the middleware. | |
146 | -// | |
147 | - | |
148 | - | |
149 | -function logger(options) { | |
150 | - | |
151 | - ensureValidOptions(options); | |
152 | - ensureValidLoggerOptions(options); | |
153 | - | |
154 | - options.requestFilter = options.requestFilter || defaultRequestFilter; | |
155 | - options.responseFilter = options.responseFilter || defaultResponseFilter; | |
156 | - options.winstonInstance = options.winstonInstance || (new winston.Logger ({ transports: options.transports })); | |
157 | - options.level = options.level || "info"; | |
158 | - options.statusLevels = options.statusLevels || false; | |
159 | - options.msg = options.msg || "HTTP {{req.method}} {{req.url}}"; | |
160 | - options.colorStatus = options.colorStatus || false; | |
161 | - options.expressFormat = options.expressFormat || false; | |
162 | - options.ignoreRoute = options.ignoreRoute || function () { return false; }; | |
163 | - options.skip = options.skip || defaultSkip; | |
164 | - | |
165 | - // Using mustache style templating | |
166 | - var template = _.template(options.msg, null, { | |
167 | - interpolate: /\{\{(.+?)\}\}/g | |
168 | - }); | |
169 | - | |
170 | - return function (req, res, next) { | |
171 | - var currentUrl = req.originalUrl ||ย req.url; | |
172 | - if (currentUrl && _.contains(ignoredRoutes, currentUrl)) return next(); | |
173 | - | |
174 | - req._startTime = (new Date); | |
175 | - | |
176 | - req._routeWhitelists = { | |
177 | - req: [], | |
178 | - res: [], | |
179 | - body: [] | |
180 | - }; | |
181 | - | |
182 | - req._routeBlacklists = { | |
183 | - body: [] | |
184 | - }; | |
185 | - | |
186 | - // try to log request first | |
187 | - if(options.expressFormat) { | |
188 | - var msg = chalk.grey(req.method + " " + req.url || req.url) | |
189 | - + " " + chalk[statusColor](res.statusCode) | |
190 | - + " " + chalk.grey(res.responseTime+"ms"); | |
191 | - } else { | |
192 | - console.log(req.body); | |
193 | - var msg = template({req: req, res: res}); | |
194 | - } | |
195 | - if (!options.skip(req, res) && !options.ignoreRoute(req, res)) { | |
196 | - var reqMsg = msg + "Request from FE - header: " + JSON.stringify(req.headers) + " body: " + JSON.stringify(req.body); | |
197 | - options.winstonInstance.log(options.level, reqMsg); | |
198 | - } | |
199 | - | |
200 | - // Manage to get information from the response too, just like Connect.logger does: | |
201 | - var end = res.end; | |
202 | - res.end = function(chunk, encoding) { | |
203 | - res.responseTime = (new Date) - req._startTime; | |
204 | - | |
205 | - res.end = end; | |
206 | - res.end(chunk, encoding); | |
207 | - | |
208 | - req.url = req.originalUrl ||ย req.url; | |
209 | - | |
210 | - if (options.statusLevels) { | |
211 | - if (res.statusCode >= 100) { options.level = "info"; } | |
212 | - if (res.statusCode >= 400) { options.level = "warn"; } | |
213 | - if (res.statusCode >= 500) { options.level = "error"; } | |
214 | - }; | |
215 | - | |
216 | - if (options.colorStatus || options.expressFormat) { | |
217 | - // Palette from https://github.com/expressjs/morgan/blob/master/index.js#L205 | |
218 | - var statusColor = 'green'; | |
219 | - if (res.statusCode >= 500) statusColor = 'red'; | |
220 | - else if (res.statusCode >= 400) statusColor = 'yellow'; | |
221 | - else if (res.statusCode >= 300) statusColor = 'cyan'; | |
222 | - var coloredStatusCode = chalk[statusColor](res.statusCode); | |
223 | - } | |
224 | - | |
225 | - var meta = {}; | |
226 | - | |
227 | - if(options.meta !== false) { | |
228 | - var bodyWhitelist, blacklist; | |
229 | - | |
230 | - requestWhitelist = requestWhitelist.concat(req._routeWhitelists.req || []); | |
231 | - responseWhitelist = responseWhitelist.concat(req._routeWhitelists.res || []); | |
232 | - | |
233 | - meta.req = filterObject(req, requestWhitelist, options.requestFilter); | |
234 | - meta.res = filterObject(res, responseWhitelist, options.responseFilter); | |
235 | - | |
236 | - if (_.contains(responseWhitelist, 'body')) { | |
237 | - if (chunk) { | |
238 | - var isJson = (res._headers && res._headers['content-type'] | |
239 | - && res._headers['content-type'].indexOf('json') >= 0); | |
240 | - | |
241 | - meta.res.body = isJson ? JSON.parse(chunk) : chunk.toString(); | |
242 | - res.body = meta.res.body; | |
243 | - } | |
244 | - } | |
245 | - | |
246 | - bodyWhitelist = req._routeWhitelists.body || []; | |
247 | - blacklist = _.union(bodyBlacklist, (req._routeBlacklists.body || [])); | |
248 | - | |
249 | - var filteredBody = null; | |
250 | - | |
251 | - if ( req.body !== undefined ) { | |
252 | - if (blacklist.length > 0 && bodyWhitelist.length === 0) { | |
253 | - var whitelist = _.difference(_.keys(req.body), blacklist); | |
254 | - filteredBody = filterObject(req.body, whitelist, options.requestFilter); | |
255 | - } else { | |
256 | - filteredBody = filterObject(req.body, bodyWhitelist, options.requestFilter); | |
257 | - } | |
258 | - } | |
259 | - | |
260 | - if (filteredBody) meta.req.body = filteredBody; | |
261 | - | |
262 | - meta.responseTime = res.responseTime; | |
263 | - } | |
264 | - | |
265 | - // if(options.expressFormat) { | |
266 | - // var msg = chalk.grey(req.method + " " + req.url || req.url) | |
267 | - // + " " + chalk[statusColor](res.statusCode) | |
268 | - // + " " + chalk.grey(res.responseTime+"ms"); | |
269 | - // } else { | |
270 | - // var msg = template({req: req, res: res}); | |
271 | - // } | |
272 | - // This is fire and forget, we don't want logging to hold up the request so don't wait for the callback | |
273 | - if (!options.skip(req, res) && !options.ignoreRoute(req, res)) { | |
274 | - var resMsg = msg + "Response to FE - header: " + JSON.stringify(res.header()._headers) + " body: " + JSON.stringify(res.body) + ", statusCode: " + res.statusCode + ", responseTime: " + res.responseTime + "ms"; | |
275 | - options.winstonInstance.log(options.level, resMsg); | |
276 | - //options.winstonInstance.log(options.level, msg, JSON.stringify(meta)); | |
277 | - } | |
278 | - }; | |
279 | - | |
280 | - next(); | |
281 | - }; | |
282 | -} | |
283 | - | |
284 | -function ensureValidOptions(options) { | |
285 | - if(!options) throw new Error("options are required by express-winston middleware"); | |
286 | - if(!((options.transports && (options.transports.length > 0)) || options.winstonInstance)) | |
287 | - throw new Error("transports or a winstonInstance are required by express-winston middleware"); | |
288 | -} | |
289 | - | |
290 | -function ensureValidLoggerOptions(options) { | |
291 | - if (options.ignoreRoute && !_.isFunction(options.ignoreRoute)) { | |
292 | - throw new Error("`ignoreRoute` express-winston option should be a function"); | |
293 | - } | |
294 | -} | |
295 | - | |
296 | -module.exports.errorLogger = errorLogger; | |
297 | -module.exports.logger = logger; | |
298 | -module.exports.requestWhitelist = requestWhitelist; | |
299 | -module.exports.bodyWhitelist = bodyWhitelist; | |
300 | -module.exports.bodyBlacklist = bodyBlacklist; | |
301 | -module.exports.responseWhitelist = responseWhitelist; | |
302 | -module.exports.defaultRequestFilter = defaultRequestFilter; | |
303 | -module.exports.defaultResponseFilter = defaultResponseFilter; | |
304 | -module.exports.defaultSkip = defaultSkip; | |
305 | -module.exports.ignoredRoutes = ignoredRoutes; |