2.2.1 • Published 3 years ago

ylogger v2.2.1

Weekly downloads
163
License
MIT
Repository
github
Last release
3 years ago

yLogger

Configure logging to GCP Logs within scalable microservices

ADVANTAGES

Forget manual configurations to catch your logging entries for GCP Logging. Copy and paste three lines of code to every script and let it handle the rest.

INSTALL

  • Add package to your project npm i ylogger --save
  • Create a yLoggerCongig.js from this template:
module.exports = {
   "yPushInUse": true,
   "yPushUrl": "YOUR_HTTPS_URL",
   "yPushToken": "YOUR_TOKEN",

   "loggingProjectID": "YOUR_PROJECT_FOR_GCP_LOGGING",
   "loggingKeyFilename": "./keys/YOUR_IAM_KEY_FOR_GCP_LOGGING",
   "serviceName": "YOUR_MICROSERVICE_NAME",
   "serviceStage": "YOUR_STAGE"
};
  • Make sure that the path for loggingKeyFilename is correct, this often causes trouble
  • Now import the library and config to your code:
const yLoggerConfig = require('./yLoggerConfig');
const logger = new yLogger(yLoggerConfig).log;
  • To create a log entry, simple call

logger("ERROR_LEVEL", "FUNCTION_NAME", "DESCRIPTION", { LOGGING_OBJECT });

e.g.

logger("error", "redisError", "connection couldn't be established", {error: err});
  • You can choose from the following log levels:
    debug / info / warning / error / critical
  • If your FUNCTION_NAME is 'sys', then yPush will be triggered.

LICENSE

This project is available under the hippocratic-license; see LICENSE.

AUTHOR

2.2.1

3 years ago

2.2.0

3 years ago

2.1.9

3 years ago

2.1.6

3 years ago

2.1.5

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

1.7.5

4 years ago

1.7.3

4 years ago

1.7.2

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.6.0

5 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

0.9.90

5 years ago

0.9.8

5 years ago

0.9.7

5 years ago

0.9.6

5 years ago

0.9.5

5 years ago

0.9.4

6 years ago

0.9.2

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago