node-calendly
Version:
Node module to access calendly api.
50 lines • 1.84 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogHandler = exports.DEBUG_LEVEL = void 0;
/*
* Copyright (C) Y-Core Invest GmbH - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
* Written by Dr. Sebastian Herden
*/
const dotenv_1 = __importDefault(require("dotenv"));
const winston_1 = __importDefault(require("winston"));
dotenv_1.default.config();
exports.DEBUG_LEVEL = process.env.DEBUG_LEVEL
? process.env.DEBUG_LEVEL
: 'info';
class LogHandler {
constructor() {
const myWinstonOptions = {
levels: winston_1.default.config.syslog.levels,
transports: [new winston_1.default.transports.Console({ level: exports.DEBUG_LEVEL })]
};
this.logger = winston_1.default.createLogger(myWinstonOptions);
}
static newInstance() {
if (!this.instance)
this.instance = new LogHandler();
return this.instance;
}
debug(text, namespace, topic) {
this.logger.debug(this.buildLogMessage(text, namespace, topic));
}
log(text, namespace, topic) {
this.logger.notice(this.buildLogMessage(text, namespace, topic));
}
info(text, namespace, topic) {
this.logger.info(this.buildLogMessage(text, namespace, topic));
}
error(text, namespace, topic) {
this.logger.error(this.buildLogMessage(text, namespace, topic));
}
buildLogMessage(text, namespace, topic) {
const now = new Date();
return '[' + now + '@' + namespace + '->' + topic + '] ' + text;
}
}
exports.LogHandler = LogHandler;
//# sourceMappingURL=Logger.js.map