Add logging

This commit is contained in:
Evgenii Abramov
2021-05-16 23:53:55 +03:00
parent 4d2f87be6a
commit 07bff61978
5 changed files with 45 additions and 27 deletions

View File

@@ -1,17 +1,20 @@
'use strict';
const {logger} = global;
const {clients} = require('../config');
module.exports.findById = (id, done) => {
for (const client of clients) {
if (client.id === id) return done(null, client);
}
return done(new Error('Client Not Found'));
logger.log('error', new Error('Client Not Found'));
return done();
};
module.exports.findByClientId = (clientId, done) => {
for (const client of clients) {
if (client.clientId === clientId) return done(null, client);
}
return done(new Error('Client Not Found'));
logger.log('error', new Error('Client Not Found'));
return done();
};