REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 3.07 KB
Close
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/winston/lib/winston/create-logger.js
Text
Base64
/** * create-logger.js: Logger factory for winston logger instances. * * (C) 2010 Charlie Robbins * MIT LICENCE */ 'use strict'; const { LEVEL } = require('triple-beam'); const config = require('./config'); const Logger = require('./logger'); const debug = require('@dabh/diagnostics')('winston:create-logger'); function isLevelEnabledFunctionName(level) { return 'is' + level.charAt(0).toUpperCase() + level.slice(1) + 'Enabled'; } /** * Create a new instance of a winston Logger. Creates a new * prototype for each instance. * @param {!Object} opts - Options for the created logger. * @returns {Logger} - A newly created logger instance. */ module.exports = function (opts = {}) { // // Default levels: npm // opts.levels = opts.levels || config.npm.levels; /** * DerivedLogger to attach the logs level methods. * @type {DerivedLogger} * @extends {Logger} */ class DerivedLogger extends Logger { /** * Create a new class derived logger for which the levels can be attached to * the prototype of. This is a V8 optimization that is well know to increase * performance of prototype functions. * @param {!Object} options - Options for the created logger. */ constructor(options) { super(options); } } const logger = new DerivedLogger(opts); // // Create the log level methods for the derived logger. // Object.keys(opts.levels).forEach(function (level) { debug('Define prototype method for "%s"', level); if (level === 'log') { // eslint-disable-next-line no-console console.warn('Level "log" not defined: conflicts with the method "log". Use a different level name.'); return; } // // Define prototype methods for each log level e.g.: // logger.log('info', msg) implies these methods are defined: // - logger.info(msg) // - logger.isInfoEnabled() // // Remark: to support logger.child this **MUST** be a function // so it'll always be called on the instance instead of a fixed // place in the prototype chain. // DerivedLogger.prototype[level] = function (...args) { // Prefer any instance scope, but default to "root" logger const self = this || logger; // Optimize the hot-path which is the single object. if (args.length === 1) { const [msg] = args; const info = msg && msg.message && msg || { message: msg }; info.level = info[LEVEL] = level; self._addDefaultMeta(info); self.write(info); return (this || logger); } // When provided nothing assume the empty string if (args.length === 0) { self.log(level, ''); return self; } // Otherwise build argument list which could potentially conform to // either: // . v3 API: log(obj) // 2. v1/v2 API: log(level, msg, ... [string interpolate], [{metadata}], [callback]) return self.log(level, ...args); }; DerivedLogger.prototype[isLevelEnabledFunctionName(level)] = function () { return (this || logger).isLevelEnabled(level); }; }); return logger; };
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 2 × Files: 10
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
config
DIR
-
drwxr-xr-x
2026-02-21 00:54:00
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
transports
DIR
-
drwxr-xr-x
2026-02-21 00:54:00
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
common.js
1016 B
lrw-r--r--
2026-02-21 00:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
container.js
3.28 KB
lrw-r--r--
2026-02-21 00:53:36
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
create-logger.js
3.07 KB
lrw-r--r--
2026-02-21 00:53:36
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
exception-handler.js
6.75 KB
lrw-r--r--
2026-02-21 00:53:38
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
exception-stream.js
1.47 KB
lrw-r--r--
2026-02-21 00:53:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
logger.js
20.04 KB
lrw-r--r--
2026-02-21 00:53:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
profiler.js
1.38 KB
lrw-r--r--
2026-02-21 00:53:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rejection-handler.js
6.82 KB
lrw-r--r--
2026-02-21 00:53:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rejection-stream.js
1.32 KB
lrw-r--r--
2026-02-21 00:53:58
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
tail-file.js
2.64 KB
lrw-r--r--
2026-02-21 00:53:58
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).