@robotlegsjs/core
Version:
An architecture-based IoC framework for JavaScript/TypeScript
91 lines • 3.42 kB
JavaScript
;
// ------------------------------------------------------------------------------
// Copyright (c) 2017-present, RobotlegsJS. All Rights Reserved.
//
// NOTICE: You are permitted to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
// ------------------------------------------------------------------------------
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
var LogLevel_1 = require("../api/LogLevel");
/**
* Default Robotlegs logger
*
* @private
*/
var Logger = /** @class */ (function () {
/*============================================================================*/
/* Constructor */
/*============================================================================*/
/**
* Creates a new logger
*
* @param source The log source object
* @param target The log target
*/
function Logger(source, target) {
this._source = source;
this._target = target;
}
Object.defineProperty(Logger.prototype, "source", {
/**
* @inheritDoc
*/
get: function () {
return this._source;
},
/*============================================================================*/
/* Public Properties */
/*============================================================================*/
/**
* @inheritDoc
*/
set: function (source) {
this._source = source;
},
enumerable: false,
configurable: true
});
/*============================================================================*/
/* Public Functions */
/*============================================================================*/
/**
* @inheritDoc
*/
Logger.prototype.debug = function (message, params) {
this._target.log(this._source, LogLevel_1.LogLevel.DEBUG, this._getTimer(), message, params);
};
/**
* @inheritDoc
*/
Logger.prototype.info = function (message, params) {
this._target.log(this._source, LogLevel_1.LogLevel.INFO, this._getTimer(), message, params);
};
/**
* @inheritDoc
*/
Logger.prototype.warn = function (message, params) {
this._target.log(this._source, LogLevel_1.LogLevel.WARN, this._getTimer(), message, params);
};
/**
* @inheritDoc
*/
Logger.prototype.error = function (message, params) {
this._target.log(this._source, LogLevel_1.LogLevel.ERROR, this._getTimer(), message, params);
};
/**
* @inheritDoc
*/
Logger.prototype.fatal = function (message, params) {
this._target.log(this._source, LogLevel_1.LogLevel.FATAL, this._getTimer(), message, params);
};
/*============================================================================*/
/* Private Functions */
/*============================================================================*/
Logger.prototype._getTimer = function () {
return Date.now();
};
return Logger;
}());
exports.Logger = Logger;
//# sourceMappingURL=Logger.js.map