0.0.6 • Published 4 years ago

cgw-commons-logging v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Logging Commons

Contains the common code required to achieve logging in a consistent and useful way through all cgw services: for example 2020-06-22T07:25:59.942Z: [src/server.js] info: Server listening on port 3202.

createLogger util function

Is a function that generates loggers that log using the following format:

${nfo.timestamp}: [${nfo.label}] ${nfo.level}: ${nfo.message}

for example:

2020-06-22T07:25:59.942Z: [src/server.js] info: Server listening on port 3202.

The httpRequestLogger

Is A wrapper function that logs all incoming and outgoing requests to all express routes available. The logs follow the format: "{{res.responseTime}}ms [{{res.statusCode}}] :: {{req.method}} {{req.url}} {{JSON.stringify(req.body)}} {{JSON.stringify(req.headers)}}" for example:

2020-06-22T07:26:02.328Z: [util/LoggerUtil.js] info: 43ms [201] :: POST /v1/messages {"recipient":"0704618228","is_priority":false,"content":"Hello from Anyfin","anyfin_customer_id":"983757","type":"sms","from":"Anyfin"} {"x-anyfin-correlationid":"1f1c2f20-af1b-11ea-bb2c-f1293a81123123","content-type":"application/json","accept":"*/*","cache-control":"no-cache","postman-token":"64739622-dcbd-400d-ad2d-344ba465cb92","host":"localhost:3202","accept-encoding":"gzip, deflate, br","connection":"keep-alive","content-length":"152"}

0.0.5

4 years ago

0.0.4

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago