-
Notifications
You must be signed in to change notification settings - Fork 0
Logging
Suraj kc edited this page Jun 30, 2020
·
1 revision
Logging is the process of writing information into log files. Log files include information about various events that happened int the system
- Troubleshooting
- Information gathering
- Profiling
- Auditing
- Generating statistics
It helps in identifying errors. It is also used in detecting security incidents, application bottlenecks and generating usage data.
- Input validation failures
- Authentication and authorization failures
- Application errors
- Configuration changes
- Application startup and shutdowns
- Application source code
- Session identification values
- Access tokens
- Passwords
- Personal data
- Database connection strings
- Encrypted values
- Structured and done at different levels
- Contain context
- Understandable to humans and parsable by machines
- Adapted to development and production
- Can be divided into several log files
logger.info('server.endpoint.get.users.getusersfromdb.format');
const handler = (func) => (req, res) => {
try {
logger.info('server.handler.begun');
func(req, res, logger);
} catch(e){
logger.info('server.handler.failed');
res.send('Oh no, something did not go well!');
}
};
More links:
Ref: