2018-10-09 23:15:39 +00:00
|
|
|
class LoggerApi {
|
|
|
|
constructor(embark) {
|
|
|
|
this.embark = embark;
|
|
|
|
this.logger = embark.logger;
|
|
|
|
|
|
|
|
this.registerAPICalls();
|
|
|
|
}
|
|
|
|
|
|
|
|
registerAPICalls(){
|
|
|
|
this.embark.registerAPICall(
|
|
|
|
'get',
|
|
|
|
'/embark-api/process-logs/embark',
|
|
|
|
(req, res) => {
|
2018-10-10 03:49:10 +00:00
|
|
|
let limit = parseInt(req.query.limit, 10);
|
|
|
|
if(!Number.isInteger(limit)) limit = 0;
|
|
|
|
res.send(this.logger.parseLogFile(limit));
|
2018-10-09 23:15:39 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = LoggerApi;
|