Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/lib/node_modules/pm2/node_modules/@opencensus/core/build/src/common/ drwxr-xr-x | |
| Viewing file: Select action/file-type: "use strict";
/**
* Copyright 2018, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const util = require("util");
const logDriver = require('log-driver');
/**
* This class implements a console logger.
*/
class ConsoleLogger {
/**
* Constructs a new ConsoleLogger instance
* @param options A logger configuration object.
*/
constructor(options) {
let opt = {};
if (typeof options === 'number') {
if (options < 0) {
options = 0;
}
else if (options > ConsoleLogger.LEVELS.length) {
options = ConsoleLogger.LEVELS.length - 1;
}
opt = { level: ConsoleLogger.LEVELS[options] };
}
else if (typeof options === 'string') {
opt = { level: options };
}
else {
opt = options || {};
}
this.level = opt.level;
this.logger =
logDriver({ levels: ConsoleLogger.LEVELS, level: opt.level || 'silent' });
}
/**
* Logger error function.
* @param message menssage erro to log in console
* @param args arguments to log in console
*/
// tslint:disable-next-line:no-any
error(message, ...args) {
this.logger.error(util.format(message, ...args));
}
/**
* Logger warning function.
* @param message menssage warning to log in console
* @param args arguments to log in console
*/
// tslint:disable-next-line:no-any
warn(message, ...args) {
this.logger.warn(util.format(message, ...args));
}
/**
* Logger info function.
* @param message menssage info to log in console
* @param args arguments to log in console
*/
// tslint:disable-next-line:no-any
info(message, ...args) {
this.logger.info(util.format(message, ...args));
}
/**
* Logger debug function.
* @param message menssage debug to log in console
* @param args arguments to log in console
*/
// tslint:disable-next-line:no-any
debug(message, ...args) {
this.logger.debug(util.format(message, ...args));
}
}
ConsoleLogger.LEVELS = ['silent', 'error', 'warn', 'info', 'debug'];
exports.ConsoleLogger = ConsoleLogger;
/**
* Function logger exported to others classes. Inspired by:
* https://github.com/cainus/logdriver/blob/bba1761737ca72f04d6b445629848538d038484a/index.js#L50
* @param options A logger options or strig to logger in console
*/
const logger = (options) => {
return new ConsoleLogger(options);
};
exports.logger = logger;
//# sourceMappingURL=console-logger.js.map |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0048 ]-- |