1.0.0-prod • Published 5 years ago
@samgaia/logger v1.0.0-prod
Logger Module
Logger client for Samgaia application
Getting Started
Prerequisites
This client module works with node >= 8.6.0
For this module to work, you need to have process environment
set with this values
SLACK_WEBHOOK_URL=
SLACK_DEFAULT_CHANNEL=
Installing
npm install gitlab:Samgaia/logger#v1.0.0-prod
Usages
- Initializing
import { Logger, ILoggerPayload } from '@Samgaia/logger';
const logger = new Logger(); // will use default channel set in environment
// or
const logger = new Logger('#optional-channel'); // OPTIONAL - will override default channel set in environment
- Log message
const payload: ILoggerPayload = {
channel: '#desired-channel', // OPTIONAL - will override default channel set in class instantiation or environment
username: 'Module - Logger', // required, use the module name that utilizing this logger
function: 'testLogger', // required, use the function name that call this logger
message: 'test message from logger test script.'// required, any message you want to log, can be a stringify error as well
};
const response = await logger.info(options);
// or just await if you dont need the response
await logger.info(options); // will have blue line for info indicator
await logger.warning(options); // will have yellow line for warning indicator
await logger.error(options); // will have red line for error indicator
Authors
- Marvin Slegt - Initial work
See also the list of contributors who participated in this project.
License
This project is private and belong to Samgaia B.V.
Latest version
- 1.0.0-prod
Issues
- Visit issues page
1.0.0-prod
5 years ago