@nglogger/core
Version:
Pluggable logger for Angular 2 / 4 / 5
339 lines • 8.35 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
'use strict';
import { Inject, Injectable, InjectionToken } from '@angular/core';
/**
* @record
*/
export function LoggerLevels() { }
function LoggerLevels_tsickle_Closure_declarations() {
/** @type {?} */
LoggerLevels.prototype.fatal;
/** @type {?} */
LoggerLevels.prototype.error;
/** @type {?} */
LoggerLevels.prototype.warn;
/** @type {?} */
LoggerLevels.prototype.info;
/** @type {?} */
LoggerLevels.prototype.verbose;
/** @type {?} */
LoggerLevels.prototype.trace;
/** @type {?} */
LoggerLevels.prototype.debug;
}
/**
* @record
*/
export function ScopedLoggerLevels() { }
function ScopedLoggerLevels_tsickle_Closure_declarations() {
/** @type {?} */
ScopedLoggerLevels.prototype.fatal;
/** @type {?} */
ScopedLoggerLevels.prototype.error;
/** @type {?} */
ScopedLoggerLevels.prototype.warn;
/** @type {?} */
ScopedLoggerLevels.prototype.info;
/** @type {?} */
ScopedLoggerLevels.prototype.verbose;
/** @type {?} */
ScopedLoggerLevels.prototype.trace;
/** @type {?} */
ScopedLoggerLevels.prototype.debug;
}
/**
* @record
*/
export function Scopable() { }
function Scopable_tsickle_Closure_declarations() {
/** @type {?} */
Scopable.prototype.scope;
}
/* Constants */
export var /** @type {?} */ TRANSPORTS = new InjectionToken('transports');
/* Helpers */
var /** @type {?} */ stubUndefined = function () { return undefined; };
var ɵ0 = stubUndefined;
var ScoppedLogger = /** @class */ (function () {
function ScoppedLogger(_logger, _scope) {
this._logger = _logger;
this._scope = _scope;
}
/**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
ScoppedLogger.prototype.fatal = /**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (subject, meta) {
return this._logger.fatal(this._scope, subject, meta);
};
/**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
ScoppedLogger.prototype.error = /**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (subject, meta) {
return this._logger.error(this._scope, subject, meta);
};
/**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
ScoppedLogger.prototype.warn = /**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (subject, meta) {
return this._logger.warn(this._scope, subject, meta);
};
/**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
ScoppedLogger.prototype.info = /**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (subject, meta) {
return this._logger.info(this._scope, subject, meta);
};
/**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
ScoppedLogger.prototype.verbose = /**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (subject, meta) {
return this._logger.verbose(this._scope, subject, meta);
};
/**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
ScoppedLogger.prototype.trace = /**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (subject, meta) {
return this._logger.trace(this._scope, subject, meta);
};
/**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
ScoppedLogger.prototype.debug = /**
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (subject, meta) {
return this._logger.debug(this._scope, subject, meta);
};
/**
* @param {?} scope
* @return {?}
*/
ScoppedLogger.prototype.scope = /**
* @param {?} scope
* @return {?}
*/
function (scope) {
return new ScoppedLogger(this._logger, scope);
};
return ScoppedLogger;
}());
export { ScoppedLogger };
function ScoppedLogger_tsickle_Closure_declarations() {
/** @type {?} */
ScoppedLogger.prototype._logger;
/** @type {?} */
ScoppedLogger.prototype._scope;
}
var Logger = /** @class */ (function () {
function Logger(_transports) {
this._transports = _transports;
}
/**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
Logger.prototype.fatal = /**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (scope, subject, meta) {
return this._log('fatal', scope, subject, meta);
};
/**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
Logger.prototype.error = /**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (scope, subject, meta) {
return this._log('error', scope, subject, meta);
};
/**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
Logger.prototype.warn = /**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (scope, subject, meta) {
return this._log('warn', scope, subject, meta);
};
/**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
Logger.prototype.info = /**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (scope, subject, meta) {
return this._log('info', scope, subject, meta);
};
/**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
Logger.prototype.verbose = /**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (scope, subject, meta) {
return this._log('verbose', scope, subject, meta);
};
/**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
Logger.prototype.trace = /**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (scope, subject, meta) {
return this._log('trace', scope, subject, meta);
};
/**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
Logger.prototype.debug = /**
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (scope, subject, meta) {
return this._log('debug', scope, subject, meta);
};
/**
* @param {?} scope
* @return {?}
*/
Logger.prototype.scope = /**
* @param {?} scope
* @return {?}
*/
function (scope) {
return new ScoppedLogger(this, scope);
};
/**
* @param {?} level
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
Logger.prototype._log = /**
* @param {?} level
* @param {?} scope
* @param {?} subject
* @param {?=} meta
* @return {?}
*/
function (level, scope, subject, meta) {
Promise.all(this._transports.map(function (transport) {
return (transport.log(level, scope, subject, meta));
}))
.then(stubUndefined)
.catch(stubUndefined);
};
Logger.decorators = [
{ type: Injectable },
];
/** @nocollapse */
Logger.ctorParameters = function () { return [
{ type: Array, decorators: [{ type: Inject, args: [TRANSPORTS,] },] },
]; };
return Logger;
}());
export { Logger };
function Logger_tsickle_Closure_declarations() {
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
Logger.decorators;
/**
* @nocollapse
* @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
*/
Logger.ctorParameters;
/** @type {?} */
Logger.prototype._transports;
}
export { ɵ0 };
//# sourceMappingURL=logger.service.js.map