@devgrid/netron
Version:
A powerful TypeScript library for building distributed systems with event bus, streaming capabilities, and remote object invocation. Features WebSocket-based bidirectional communication between Node.js and browser environments, service discovery, and type
29 lines • 1.14 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.logger = void 0;
const pino_1 = __importDefault(require("pino"));
const config_1 = require("./config");
class LoggerFactory {
static getLogger(context) {
if (!LoggerFactory.rootLogger) {
LoggerFactory.rootLogger = (0, pino_1.default)(config_1.defaultLoggingOptions);
}
return context ? LoggerFactory.rootLogger.child(context) : LoggerFactory.rootLogger;
}
static initLogger(options, destination) {
const mergedOptions = { ...config_1.defaultLoggingOptions, ...options };
if (destination) {
delete mergedOptions.transport;
LoggerFactory.rootLogger = (0, pino_1.default)(mergedOptions, destination);
}
else {
LoggerFactory.rootLogger = (0, pino_1.default)(mergedOptions);
}
}
}
exports.logger = LoggerFactory.getLogger();
exports.default = LoggerFactory;
//# sourceMappingURL=logger.js.map