Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
3
node_modules/winston-transport/.babelrc
generated
vendored
Normal file
3
node_modules/winston-transport/.babelrc
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"presets": ["env"]
|
||||
}
|
7
node_modules/winston-transport/.eslintrc
generated
vendored
Normal file
7
node_modules/winston-transport/.eslintrc
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"extends": "@dabh/eslint-config-populist",
|
||||
"rules": {
|
||||
"one-var": ["error", { var: "never", let: "never", const: "never" }],
|
||||
"strict": 0
|
||||
}
|
||||
}
|
1
node_modules/winston-transport/.gitattributes
generated
vendored
Normal file
1
node_modules/winston-transport/.gitattributes
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
package-lock.json binary
|
1
node_modules/winston-transport/.nyc_output/274df42e-36fd-4f23-8333-4c74852d009a.json
generated
vendored
Normal file
1
node_modules/winston-transport/.nyc_output/274df42e-36fd-4f23-8333-4c74852d009a.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/winston-transport/.nyc_output/processinfo/274df42e-36fd-4f23-8333-4c74852d009a.json
generated
vendored
Normal file
1
node_modules/winston-transport/.nyc_output/processinfo/274df42e-36fd-4f23-8333-4c74852d009a.json
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"parent":null,"pid":20174,"argv":["/Users/dabh/.nvm/versions/node/v20.15.1/bin/node","/Users/dabh/winston-transport/node_modules/.bin/mocha","test/index.test.js","test/inheritance.test.js","test/legacy.test.js"],"execArgv":[],"cwd":"/Users/dabh/winston-transport","time":1727464051766,"ppid":20173,"coverageFilename":"/Users/dabh/winston-transport/.nyc_output/274df42e-36fd-4f23-8333-4c74852d009a.json","externalId":"","uuid":"274df42e-36fd-4f23-8333-4c74852d009a","files":["/Users/dabh/winston-transport/index.js","/Users/dabh/winston-transport/modern.js","/Users/dabh/winston-transport/legacy.js"]}
|
1
node_modules/winston-transport/.nyc_output/processinfo/index.json
generated
vendored
Normal file
1
node_modules/winston-transport/.nyc_output/processinfo/index.json
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"processes":{"274df42e-36fd-4f23-8333-4c74852d009a":{"parent":null,"children":[]}},"files":{"/Users/dabh/winston-transport/index.js":["274df42e-36fd-4f23-8333-4c74852d009a"],"/Users/dabh/winston-transport/modern.js":["274df42e-36fd-4f23-8333-4c74852d009a"],"/Users/dabh/winston-transport/legacy.js":["274df42e-36fd-4f23-8333-4c74852d009a"]},"externalIds":{}}
|
126
node_modules/winston-transport/CHANGELOG.md
generated
vendored
Normal file
126
node_modules/winston-transport/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,126 @@
|
|||
# CHANGELOG
|
||||
|
||||
### 4.5.0 (2022/02/05)
|
||||
|
||||
- [#81] Memory leak fix: do not wait for `process.nextTick` to clear callbacks
|
||||
- [#87, #82, #67] Update dependencies, CI config, and linter config
|
||||
|
||||
### 4.4.1 (2021/12/14)
|
||||
|
||||
- [#44] Add handleRejections to types.
|
||||
- [#60] Exclude unnecessary files from npm package
|
||||
- [#45] [#58] Update dependencies.
|
||||
|
||||
### 4.4.0 (2018/12/23)
|
||||
|
||||
- [#41] Support handleRejections option.
|
||||
- [#42] Expose LegacyTransportStream from the base module.
|
||||
- Update dependencies.
|
||||
|
||||
### 4.3.0 (2018/12/23)
|
||||
|
||||
- [#30] Precompile before publishing to `npm`.
|
||||
- [#32] Add new option to increase default `highWaterMark` value.
|
||||
|
||||
### 4.2.0 (2018/06/11)
|
||||
|
||||
- [#26] Do not use copy-by-value for `this.level`.
|
||||
- [#25] Wrap calls to `format.transform` with try / catch.
|
||||
- [#24] Use `readable-stream` package to get the _final semantics across all versions of Node.
|
||||
|
||||
### 4.1.0 (2018/05/31)
|
||||
|
||||
- [#23] Revert to prototypal-based syntax for backwards compatibility.
|
||||
|
||||
### 4.0.0 (2018/05/24)
|
||||
|
||||
- **BREAKING** Update transports to use ES6 classes. Creation of
|
||||
`TransportStream` and `LegacyTransportStream` now requires the `new` keyword.
|
||||
|
||||
**No longer works**
|
||||
``` js
|
||||
const Transport = require('winston-transport');
|
||||
const transport = Transport({
|
||||
log: (info, callback) => { /* log something */ }
|
||||
});
|
||||
```
|
||||
|
||||
**Do this instead**
|
||||
``` js
|
||||
const Transport = require('winston-transport');
|
||||
const transport = new Transport({
|
||||
log: (info, callback) => { /* log something */ }
|
||||
});
|
||||
```
|
||||
|
||||
### 3.3.0 (2018/05/24)
|
||||
**Unpublished:** overlooked that 26f816e introduced a breaking change.
|
||||
|
||||
- [#21] Do not log when there is no info object.
|
||||
- [#20] Add silent options to typings.
|
||||
- [#19] Refactor test fixtures to use es6-classes.
|
||||
- [#18] Use triple-beam for info object constants.
|
||||
- [#17] Add linting and Node v10 to the travis build of the project.
|
||||
|
||||
### 3.2.1 (2018/04/25)
|
||||
|
||||
- [#16] Reorder in TS defs: namespace must come after class in order for delcaration merging to work as expected.
|
||||
|
||||
### 3.2.0 (2018/04/22)
|
||||
|
||||
- [#13] Add silent support to LegacyTransportStream. Fixes [#8].
|
||||
- [#14] Ensure that if a Transport-specific format is provided it is invoked on each chunk before passing it to `.log`. Fixes [#12].
|
||||
- [#11] Revice `d.ts`
|
||||
- Add `.travis.yml`.
|
||||
- Documentation updates:
|
||||
- [#5] Update deprecated link.
|
||||
- [#7] Correct `this` reference in `README.md` by using an arrow function.
|
||||
|
||||
### 3.1.0 (2018/04/06)
|
||||
|
||||
- [#10] Add `silent` option to `TransportStream`. Still needs to be implemented
|
||||
for `LegacyTransportStream`.
|
||||
- Bump `mocha` to `^5.0.5`.
|
||||
- Bump `nyc` to `^11.6.0`.
|
||||
|
||||
### 3.0.1 (2017/10/01)
|
||||
|
||||
- [#4] Use ES6-class for defining Transport in `README.md`.
|
||||
- [#4] Do not overwrite prototypal methods unless they are provided in the options.
|
||||
|
||||
### 3.0.0 (2017/09/29)
|
||||
|
||||
- Use `Symbol.for('level')` to lookup immutable `level` on `info` objects.
|
||||
|
||||
### 2.1.1 (2017/09/29)
|
||||
|
||||
- Properly interact with the `{ format }`, if provided.
|
||||
|
||||
### 2.1.0 (2017/09/27)
|
||||
|
||||
- If a format is defined use it to mutate the info.
|
||||
|
||||
### 2.0.0 (2017/04/11)
|
||||
|
||||
- [#2] Final semantics for `winston-transport` base implementations:
|
||||
- `TransportStream`: the new `objectMode` Writable stream which should be the base for all future Transports after `winston >= 3`.
|
||||
- `LegacyTransportStream`: the backwards compatible wrap to Transports written for `winston < 3`. There isn't all that much different for those implementors except that `log(level, message, meta, callback)` is now `log(info, callback)` where `info` is the object being plumbed along the objectMode pipe-chain. This was absolutely critical to not "break the ecosystem" and give [the over 500 Transport package authors](https://www.npmjs.com/search?q=winston) an upgrade path.
|
||||
- Along with all the code coverage & `WritableStream` goodies:
|
||||
- 100% code coverage for `TransportStream`
|
||||
- 100% code coverage for `LegacyTransportStream`
|
||||
- Implementation of `_writev` for `TransportStream`
|
||||
- Implementation of `_writev` for `LegacyTransportStream`
|
||||
|
||||
### 1.0.2 (2015/11/30)
|
||||
|
||||
- Pass the write stream callback so that we can communicate backpressure up the chain of streams.
|
||||
|
||||
### 1.0.1 (2015/11/22)
|
||||
|
||||
- First `require`-able version.
|
||||
|
||||
### 1.0.0 (2015/11/22)
|
||||
|
||||
- Initial version.
|
||||
|
||||
[#2]: https://github.com/winstonjs/winston-transport/pull/2
|
22
node_modules/winston-transport/LICENSE
generated
vendored
Normal file
22
node_modules/winston-transport/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Charlie Robbins & the contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
50
node_modules/winston-transport/README.md
generated
vendored
Normal file
50
node_modules/winston-transport/README.md
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
# winston-transport
|
||||
|
||||
The base `TransportStream` implementation for `winston >= 3`. Use these to
|
||||
write ecosystem Transports for `winston`.
|
||||
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
const Transport = require('winston-transport');
|
||||
const util = require('util');
|
||||
|
||||
//
|
||||
// Inherit from `winston-transport` so you can take advantage
|
||||
// of the base functionality and `.exceptions.handle()`.
|
||||
//
|
||||
module.exports = class CustomTransport extends Transport {
|
||||
constructor(opts) {
|
||||
super(opts);
|
||||
|
||||
//
|
||||
// Consume any custom options here. e.g.:
|
||||
// - Connection information for databases
|
||||
// - Authentication information for APIs (e.g. loggly, papertrail,
|
||||
// logentries, etc.).
|
||||
//
|
||||
}
|
||||
|
||||
log(info, callback) {
|
||||
setImmediate(() => {
|
||||
this.emit('logged', info);
|
||||
});
|
||||
|
||||
// Perform the writing to the remote service
|
||||
|
||||
callback();
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
Tests are written with `mocha`, `nyc`, `assume`, and
|
||||
`abstract-winston-transport`. They can be run with `npm`:
|
||||
|
||||
``` bash
|
||||
npm test
|
||||
```
|
||||
|
||||
##### Author: [Charlie Robbins](https://github.com/indexzero)
|
||||
##### LICENSE: MIT
|
8
node_modules/winston-transport/dist/index.js
generated
vendored
Normal file
8
node_modules/winston-transport/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
// Expose modern transport directly as the export
|
||||
|
||||
module.exports = require('./modern');
|
||||
|
||||
// Expose legacy stream
|
||||
module.exports.LegacyTransportStream = require('./legacy');
|
116
node_modules/winston-transport/dist/legacy.js
generated
vendored
Normal file
116
node_modules/winston-transport/dist/legacy.js
generated
vendored
Normal file
|
@ -0,0 +1,116 @@
|
|||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var _require = require('triple-beam'),
|
||||
LEVEL = _require.LEVEL;
|
||||
|
||||
var TransportStream = require('./modern');
|
||||
|
||||
/**
|
||||
* Constructor function for the LegacyTransportStream. This is an internal
|
||||
* wrapper `winston >= 3` uses to wrap older transports implementing
|
||||
* log(level, message, meta).
|
||||
* @param {Object} options - Options for this TransportStream instance.
|
||||
* @param {Transpot} options.transport - winston@2 or older Transport to wrap.
|
||||
*/
|
||||
|
||||
var LegacyTransportStream = module.exports = function LegacyTransportStream() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
TransportStream.call(this, options);
|
||||
if (!options.transport || typeof options.transport.log !== 'function') {
|
||||
throw new Error('Invalid transport, must be an object with a log method.');
|
||||
}
|
||||
|
||||
this.transport = options.transport;
|
||||
this.level = this.level || options.transport.level;
|
||||
this.handleExceptions = this.handleExceptions || options.transport.handleExceptions;
|
||||
|
||||
// Display our deprecation notice.
|
||||
this._deprecated();
|
||||
|
||||
// Properly bubble up errors from the transport to the
|
||||
// LegacyTransportStream instance, but only once no matter how many times
|
||||
// this transport is shared.
|
||||
function transportError(err) {
|
||||
this.emit('error', err, this.transport);
|
||||
}
|
||||
|
||||
if (!this.transport.__winstonError) {
|
||||
this.transport.__winstonError = transportError.bind(this);
|
||||
this.transport.on('error', this.transport.__winstonError);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Inherit from TransportStream using Node.js built-ins
|
||||
*/
|
||||
util.inherits(LegacyTransportStream, TransportStream);
|
||||
|
||||
/**
|
||||
* Writes the info object to our transport instance.
|
||||
* @param {mixed} info - TODO: add param description.
|
||||
* @param {mixed} enc - TODO: add param description.
|
||||
* @param {function} callback - TODO: add param description.
|
||||
* @returns {undefined}
|
||||
* @private
|
||||
*/
|
||||
LegacyTransportStream.prototype._write = function _write(info, enc, callback) {
|
||||
if (this.silent || info.exception === true && !this.handleExceptions) {
|
||||
return callback(null);
|
||||
}
|
||||
|
||||
// Remark: This has to be handled in the base transport now because we
|
||||
// cannot conditionally write to our pipe targets as stream.
|
||||
if (!this.level || this.levels[this.level] >= this.levels[info[LEVEL]]) {
|
||||
this.transport.log(info[LEVEL], info.message, info, this._nop);
|
||||
}
|
||||
|
||||
callback(null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes the batch of info objects (i.e. "object chunks") to our transport
|
||||
* instance after performing any necessary filtering.
|
||||
* @param {mixed} chunks - TODO: add params description.
|
||||
* @param {function} callback - TODO: add params description.
|
||||
* @returns {mixed} - TODO: add returns description.
|
||||
* @private
|
||||
*/
|
||||
LegacyTransportStream.prototype._writev = function _writev(chunks, callback) {
|
||||
for (var i = 0; i < chunks.length; i++) {
|
||||
if (this._accept(chunks[i])) {
|
||||
this.transport.log(chunks[i].chunk[LEVEL], chunks[i].chunk.message, chunks[i].chunk, this._nop);
|
||||
chunks[i].callback();
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Displays a deprecation notice. Defined as a function so it can be
|
||||
* overriden in tests.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
LegacyTransportStream.prototype._deprecated = function _deprecated() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error([this.transport.name + ' is a legacy winston transport. Consider upgrading: ', '- Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md'].join('\n'));
|
||||
};
|
||||
|
||||
/**
|
||||
* Clean up error handling state on the legacy transport associated
|
||||
* with this instance.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
LegacyTransportStream.prototype.close = function close() {
|
||||
if (this.transport.close) {
|
||||
this.transport.close();
|
||||
}
|
||||
|
||||
if (this.transport.__winstonError) {
|
||||
this.transport.removeListener('error', this.transport.__winstonError);
|
||||
this.transport.__winstonError = null;
|
||||
}
|
||||
};
|
212
node_modules/winston-transport/dist/modern.js
generated
vendored
Normal file
212
node_modules/winston-transport/dist/modern.js
generated
vendored
Normal file
|
@ -0,0 +1,212 @@
|
|||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var Writable = require('readable-stream/lib/_stream_writable.js');
|
||||
|
||||
var _require = require('triple-beam'),
|
||||
LEVEL = _require.LEVEL;
|
||||
|
||||
/**
|
||||
* Constructor function for the TransportStream. This is the base prototype
|
||||
* that all `winston >= 3` transports should inherit from.
|
||||
* @param {Object} options - Options for this TransportStream instance
|
||||
* @param {String} options.level - Highest level according to RFC5424.
|
||||
* @param {Boolean} options.handleExceptions - If true, info with
|
||||
* { exception: true } will be written.
|
||||
* @param {Function} options.log - Custom log function for simple Transport
|
||||
* creation
|
||||
* @param {Function} options.close - Called on "unpipe" from parent.
|
||||
*/
|
||||
|
||||
|
||||
var TransportStream = module.exports = function TransportStream() {
|
||||
var _this = this;
|
||||
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
Writable.call(this, { objectMode: true, highWaterMark: options.highWaterMark });
|
||||
|
||||
this.format = options.format;
|
||||
this.level = options.level;
|
||||
this.handleExceptions = options.handleExceptions;
|
||||
this.handleRejections = options.handleRejections;
|
||||
this.silent = options.silent;
|
||||
|
||||
if (options.log) this.log = options.log;
|
||||
if (options.logv) this.logv = options.logv;
|
||||
if (options.close) this.close = options.close;
|
||||
|
||||
// Get the levels from the source we are piped from.
|
||||
this.once('pipe', function (logger) {
|
||||
// Remark (indexzero): this bookkeeping can only support multiple
|
||||
// Logger parents with the same `levels`. This comes into play in
|
||||
// the `winston.Container` code in which `container.add` takes
|
||||
// a fully realized set of options with pre-constructed TransportStreams.
|
||||
_this.levels = logger.levels;
|
||||
_this.parent = logger;
|
||||
});
|
||||
|
||||
// If and/or when the transport is removed from this instance
|
||||
this.once('unpipe', function (src) {
|
||||
// Remark (indexzero): this bookkeeping can only support multiple
|
||||
// Logger parents with the same `levels`. This comes into play in
|
||||
// the `winston.Container` code in which `container.add` takes
|
||||
// a fully realized set of options with pre-constructed TransportStreams.
|
||||
if (src === _this.parent) {
|
||||
_this.parent = null;
|
||||
if (_this.close) {
|
||||
_this.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Inherit from Writeable using Node.js built-ins
|
||||
*/
|
||||
util.inherits(TransportStream, Writable);
|
||||
|
||||
/**
|
||||
* Writes the info object to our transport instance.
|
||||
* @param {mixed} info - TODO: add param description.
|
||||
* @param {mixed} enc - TODO: add param description.
|
||||
* @param {function} callback - TODO: add param description.
|
||||
* @returns {undefined}
|
||||
* @private
|
||||
*/
|
||||
TransportStream.prototype._write = function _write(info, enc, callback) {
|
||||
if (this.silent || info.exception === true && !this.handleExceptions) {
|
||||
return callback(null);
|
||||
}
|
||||
|
||||
// Remark: This has to be handled in the base transport now because we
|
||||
// cannot conditionally write to our pipe targets as stream. We always
|
||||
// prefer any explicit level set on the Transport itself falling back to
|
||||
// any level set on the parent.
|
||||
var level = this.level || this.parent && this.parent.level;
|
||||
|
||||
if (!level || this.levels[level] >= this.levels[info[LEVEL]]) {
|
||||
if (info && !this.format) {
|
||||
return this.log(info, callback);
|
||||
}
|
||||
|
||||
var errState = void 0;
|
||||
var transformed = void 0;
|
||||
|
||||
// We trap(and re-throw) any errors generated by the user-provided format, but also
|
||||
// guarantee that the streams callback is invoked so that we can continue flowing.
|
||||
try {
|
||||
transformed = this.format.transform(Object.assign({}, info), this.format.options);
|
||||
} catch (err) {
|
||||
errState = err;
|
||||
}
|
||||
|
||||
if (errState || !transformed) {
|
||||
// eslint-disable-next-line callback-return
|
||||
callback();
|
||||
if (errState) throw errState;
|
||||
return;
|
||||
}
|
||||
|
||||
return this.log(transformed, callback);
|
||||
}
|
||||
this._writableState.sync = false;
|
||||
return callback(null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes the batch of info objects (i.e. "object chunks") to our transport
|
||||
* instance after performing any necessary filtering.
|
||||
* @param {mixed} chunks - TODO: add params description.
|
||||
* @param {function} callback - TODO: add params description.
|
||||
* @returns {mixed} - TODO: add returns description.
|
||||
* @private
|
||||
*/
|
||||
TransportStream.prototype._writev = function _writev(chunks, callback) {
|
||||
if (this.logv) {
|
||||
var infos = chunks.filter(this._accept, this);
|
||||
if (!infos.length) {
|
||||
return callback(null);
|
||||
}
|
||||
|
||||
// Remark (indexzero): from a performance perspective if Transport
|
||||
// implementers do choose to implement logv should we make it their
|
||||
// responsibility to invoke their format?
|
||||
return this.logv(infos, callback);
|
||||
}
|
||||
|
||||
for (var i = 0; i < chunks.length; i++) {
|
||||
if (!this._accept(chunks[i])) continue;
|
||||
|
||||
if (chunks[i].chunk && !this.format) {
|
||||
this.log(chunks[i].chunk, chunks[i].callback);
|
||||
continue;
|
||||
}
|
||||
|
||||
var errState = void 0;
|
||||
var transformed = void 0;
|
||||
|
||||
// We trap(and re-throw) any errors generated by the user-provided format, but also
|
||||
// guarantee that the streams callback is invoked so that we can continue flowing.
|
||||
try {
|
||||
transformed = this.format.transform(Object.assign({}, chunks[i].chunk), this.format.options);
|
||||
} catch (err) {
|
||||
errState = err;
|
||||
}
|
||||
|
||||
if (errState || !transformed) {
|
||||
// eslint-disable-next-line callback-return
|
||||
chunks[i].callback();
|
||||
if (errState) {
|
||||
// eslint-disable-next-line callback-return
|
||||
callback(null);
|
||||
throw errState;
|
||||
}
|
||||
} else {
|
||||
this.log(transformed, chunks[i].callback);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Predicate function that returns true if the specfied `info` on the
|
||||
* WriteReq, `write`, should be passed down into the derived
|
||||
* TransportStream's I/O via `.log(info, callback)`.
|
||||
* @param {WriteReq} write - winston@3 Node.js WriteReq for the `info` object
|
||||
* representing the log message.
|
||||
* @returns {Boolean} - Value indicating if the `write` should be accepted &
|
||||
* logged.
|
||||
*/
|
||||
TransportStream.prototype._accept = function _accept(write) {
|
||||
var info = write.chunk;
|
||||
if (this.silent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We always prefer any explicit level set on the Transport itself
|
||||
// falling back to any level set on the parent.
|
||||
var level = this.level || this.parent && this.parent.level;
|
||||
|
||||
// Immediately check the average case: log level filtering.
|
||||
if (info.exception === true || !level || this.levels[level] >= this.levels[info[LEVEL]]) {
|
||||
// Ensure the info object is valid based on `{ exception }`:
|
||||
// 1. { handleExceptions: true }: all `info` objects are valid
|
||||
// 2. { exception: false }: accepted by all transports.
|
||||
if (this.handleExceptions || info.exception !== true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* _nop is short for "No operation"
|
||||
* @returns {Boolean} Intentionally false.
|
||||
*/
|
||||
TransportStream.prototype._nop = function _nop() {
|
||||
// eslint-disable-next-line no-undefined
|
||||
return void undefined;
|
||||
};
|
39
node_modules/winston-transport/index.d.ts
generated
vendored
Normal file
39
node_modules/winston-transport/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
// Type definitions for winston-transport 3.0
|
||||
// Project: https://github.com/winstonjs/winston-transport
|
||||
// Definitions by: DABH <https://github.com/DABH>
|
||||
// Definitions: https://github.com/winstonjs/winston-transport
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as stream from 'stream';
|
||||
import * as logform from 'logform';
|
||||
|
||||
declare class TransportStream extends stream.Writable {
|
||||
public format?: logform.Format;
|
||||
public level?: string;
|
||||
public silent?: boolean;
|
||||
public handleExceptions?: boolean;
|
||||
public handleRejections?: boolean;
|
||||
|
||||
constructor(opts?: TransportStream.TransportStreamOptions);
|
||||
|
||||
public log?(info: any, next: () => void): any;
|
||||
public logv?(info: any, next: () => void): any;
|
||||
public close?(): void;
|
||||
}
|
||||
|
||||
declare namespace TransportStream {
|
||||
interface TransportStreamOptions {
|
||||
format?: logform.Format;
|
||||
level?: string;
|
||||
silent?: boolean;
|
||||
handleExceptions?: boolean;
|
||||
handleRejections?: boolean;
|
||||
|
||||
log?(info: any, next: () => void): any;
|
||||
logv?(info: any, next: () => void): any;
|
||||
close?(): void;
|
||||
}
|
||||
}
|
||||
|
||||
export = TransportStream;
|
7
node_modules/winston-transport/index.js
generated
vendored
Normal file
7
node_modules/winston-transport/index.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
// Expose modern transport directly as the export
|
||||
module.exports = require('./modern');
|
||||
|
||||
// Expose legacy stream
|
||||
module.exports.LegacyTransportStream = require('./legacy');
|
119
node_modules/winston-transport/legacy.js
generated
vendored
Normal file
119
node_modules/winston-transport/legacy.js
generated
vendored
Normal file
|
@ -0,0 +1,119 @@
|
|||
'use strict';
|
||||
|
||||
const util = require('util');
|
||||
const { LEVEL } = require('triple-beam');
|
||||
const TransportStream = require('./modern');
|
||||
|
||||
/**
|
||||
* Constructor function for the LegacyTransportStream. This is an internal
|
||||
* wrapper `winston >= 3` uses to wrap older transports implementing
|
||||
* log(level, message, meta).
|
||||
* @param {Object} options - Options for this TransportStream instance.
|
||||
* @param {Transpot} options.transport - winston@2 or older Transport to wrap.
|
||||
*/
|
||||
|
||||
const LegacyTransportStream = module.exports = function LegacyTransportStream(options = {}) {
|
||||
TransportStream.call(this, options);
|
||||
if (!options.transport || typeof options.transport.log !== 'function') {
|
||||
throw new Error('Invalid transport, must be an object with a log method.');
|
||||
}
|
||||
|
||||
this.transport = options.transport;
|
||||
this.level = this.level || options.transport.level;
|
||||
this.handleExceptions = this.handleExceptions || options.transport.handleExceptions;
|
||||
|
||||
// Display our deprecation notice.
|
||||
this._deprecated();
|
||||
|
||||
// Properly bubble up errors from the transport to the
|
||||
// LegacyTransportStream instance, but only once no matter how many times
|
||||
// this transport is shared.
|
||||
function transportError(err) {
|
||||
this.emit('error', err, this.transport);
|
||||
}
|
||||
|
||||
if (!this.transport.__winstonError) {
|
||||
this.transport.__winstonError = transportError.bind(this);
|
||||
this.transport.on('error', this.transport.__winstonError);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Inherit from TransportStream using Node.js built-ins
|
||||
*/
|
||||
util.inherits(LegacyTransportStream, TransportStream);
|
||||
|
||||
/**
|
||||
* Writes the info object to our transport instance.
|
||||
* @param {mixed} info - TODO: add param description.
|
||||
* @param {mixed} enc - TODO: add param description.
|
||||
* @param {function} callback - TODO: add param description.
|
||||
* @returns {undefined}
|
||||
* @private
|
||||
*/
|
||||
LegacyTransportStream.prototype._write = function _write(info, enc, callback) {
|
||||
if (this.silent || (info.exception === true && !this.handleExceptions)) {
|
||||
return callback(null);
|
||||
}
|
||||
|
||||
// Remark: This has to be handled in the base transport now because we
|
||||
// cannot conditionally write to our pipe targets as stream.
|
||||
if (!this.level || this.levels[this.level] >= this.levels[info[LEVEL]]) {
|
||||
this.transport.log(info[LEVEL], info.message, info, this._nop);
|
||||
}
|
||||
|
||||
callback(null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes the batch of info objects (i.e. "object chunks") to our transport
|
||||
* instance after performing any necessary filtering.
|
||||
* @param {mixed} chunks - TODO: add params description.
|
||||
* @param {function} callback - TODO: add params description.
|
||||
* @returns {mixed} - TODO: add returns description.
|
||||
* @private
|
||||
*/
|
||||
LegacyTransportStream.prototype._writev = function _writev(chunks, callback) {
|
||||
for (let i = 0; i < chunks.length; i++) {
|
||||
if (this._accept(chunks[i])) {
|
||||
this.transport.log(
|
||||
chunks[i].chunk[LEVEL],
|
||||
chunks[i].chunk.message,
|
||||
chunks[i].chunk,
|
||||
this._nop
|
||||
);
|
||||
chunks[i].callback();
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Displays a deprecation notice. Defined as a function so it can be
|
||||
* overriden in tests.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
LegacyTransportStream.prototype._deprecated = function _deprecated() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error([
|
||||
`${this.transport.name} is a legacy winston transport. Consider upgrading: `,
|
||||
'- Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md'
|
||||
].join('\n'));
|
||||
};
|
||||
|
||||
/**
|
||||
* Clean up error handling state on the legacy transport associated
|
||||
* with this instance.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
LegacyTransportStream.prototype.close = function close() {
|
||||
if (this.transport.close) {
|
||||
this.transport.close();
|
||||
}
|
||||
|
||||
if (this.transport.__winstonError) {
|
||||
this.transport.removeListener('error', this.transport.__winstonError);
|
||||
this.transport.__winstonError = null;
|
||||
}
|
||||
};
|
211
node_modules/winston-transport/modern.js
generated
vendored
Normal file
211
node_modules/winston-transport/modern.js
generated
vendored
Normal file
|
@ -0,0 +1,211 @@
|
|||
'use strict';
|
||||
|
||||
const util = require('util');
|
||||
const Writable = require('readable-stream/lib/_stream_writable.js');
|
||||
const { LEVEL } = require('triple-beam');
|
||||
|
||||
/**
|
||||
* Constructor function for the TransportStream. This is the base prototype
|
||||
* that all `winston >= 3` transports should inherit from.
|
||||
* @param {Object} options - Options for this TransportStream instance
|
||||
* @param {String} options.level - Highest level according to RFC5424.
|
||||
* @param {Boolean} options.handleExceptions - If true, info with
|
||||
* { exception: true } will be written.
|
||||
* @param {Function} options.log - Custom log function for simple Transport
|
||||
* creation
|
||||
* @param {Function} options.close - Called on "unpipe" from parent.
|
||||
*/
|
||||
const TransportStream = module.exports = function TransportStream(options = {}) {
|
||||
Writable.call(this, { objectMode: true, highWaterMark: options.highWaterMark });
|
||||
|
||||
this.format = options.format;
|
||||
this.level = options.level;
|
||||
this.handleExceptions = options.handleExceptions;
|
||||
this.handleRejections = options.handleRejections;
|
||||
this.silent = options.silent;
|
||||
|
||||
if (options.log) this.log = options.log;
|
||||
if (options.logv) this.logv = options.logv;
|
||||
if (options.close) this.close = options.close;
|
||||
|
||||
// Get the levels from the source we are piped from.
|
||||
this.once('pipe', logger => {
|
||||
// Remark (indexzero): this bookkeeping can only support multiple
|
||||
// Logger parents with the same `levels`. This comes into play in
|
||||
// the `winston.Container` code in which `container.add` takes
|
||||
// a fully realized set of options with pre-constructed TransportStreams.
|
||||
this.levels = logger.levels;
|
||||
this.parent = logger;
|
||||
});
|
||||
|
||||
// If and/or when the transport is removed from this instance
|
||||
this.once('unpipe', src => {
|
||||
// Remark (indexzero): this bookkeeping can only support multiple
|
||||
// Logger parents with the same `levels`. This comes into play in
|
||||
// the `winston.Container` code in which `container.add` takes
|
||||
// a fully realized set of options with pre-constructed TransportStreams.
|
||||
if (src === this.parent) {
|
||||
this.parent = null;
|
||||
if (this.close) {
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Inherit from Writeable using Node.js built-ins
|
||||
*/
|
||||
util.inherits(TransportStream, Writable);
|
||||
|
||||
/**
|
||||
* Writes the info object to our transport instance.
|
||||
* @param {mixed} info - TODO: add param description.
|
||||
* @param {mixed} enc - TODO: add param description.
|
||||
* @param {function} callback - TODO: add param description.
|
||||
* @returns {undefined}
|
||||
* @private
|
||||
*/
|
||||
TransportStream.prototype._write = function _write(info, enc, callback) {
|
||||
if (this.silent || (info.exception === true && !this.handleExceptions)) {
|
||||
return callback(null);
|
||||
}
|
||||
|
||||
// Remark: This has to be handled in the base transport now because we
|
||||
// cannot conditionally write to our pipe targets as stream. We always
|
||||
// prefer any explicit level set on the Transport itself falling back to
|
||||
// any level set on the parent.
|
||||
const level = this.level || (this.parent && this.parent.level);
|
||||
|
||||
if (!level || this.levels[level] >= this.levels[info[LEVEL]]) {
|
||||
if (info && !this.format) {
|
||||
return this.log(info, callback);
|
||||
}
|
||||
|
||||
let errState;
|
||||
let transformed;
|
||||
|
||||
// We trap(and re-throw) any errors generated by the user-provided format, but also
|
||||
// guarantee that the streams callback is invoked so that we can continue flowing.
|
||||
try {
|
||||
transformed = this.format.transform(Object.assign({}, info), this.format.options);
|
||||
} catch (err) {
|
||||
errState = err;
|
||||
}
|
||||
|
||||
if (errState || !transformed) {
|
||||
// eslint-disable-next-line callback-return
|
||||
callback();
|
||||
if (errState) throw errState;
|
||||
return;
|
||||
}
|
||||
|
||||
return this.log(transformed, callback);
|
||||
}
|
||||
this._writableState.sync = false;
|
||||
return callback(null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes the batch of info objects (i.e. "object chunks") to our transport
|
||||
* instance after performing any necessary filtering.
|
||||
* @param {mixed} chunks - TODO: add params description.
|
||||
* @param {function} callback - TODO: add params description.
|
||||
* @returns {mixed} - TODO: add returns description.
|
||||
* @private
|
||||
*/
|
||||
TransportStream.prototype._writev = function _writev(chunks, callback) {
|
||||
if (this.logv) {
|
||||
const infos = chunks.filter(this._accept, this);
|
||||
if (!infos.length) {
|
||||
return callback(null);
|
||||
}
|
||||
|
||||
// Remark (indexzero): from a performance perspective if Transport
|
||||
// implementers do choose to implement logv should we make it their
|
||||
// responsibility to invoke their format?
|
||||
return this.logv(infos, callback);
|
||||
}
|
||||
|
||||
for (let i = 0; i < chunks.length; i++) {
|
||||
if (!this._accept(chunks[i])) continue;
|
||||
|
||||
if (chunks[i].chunk && !this.format) {
|
||||
this.log(chunks[i].chunk, chunks[i].callback);
|
||||
continue;
|
||||
}
|
||||
|
||||
let errState;
|
||||
let transformed;
|
||||
|
||||
// We trap(and re-throw) any errors generated by the user-provided format, but also
|
||||
// guarantee that the streams callback is invoked so that we can continue flowing.
|
||||
try {
|
||||
transformed = this.format.transform(
|
||||
Object.assign({}, chunks[i].chunk),
|
||||
this.format.options
|
||||
);
|
||||
} catch (err) {
|
||||
errState = err;
|
||||
}
|
||||
|
||||
if (errState || !transformed) {
|
||||
// eslint-disable-next-line callback-return
|
||||
chunks[i].callback();
|
||||
if (errState) {
|
||||
// eslint-disable-next-line callback-return
|
||||
callback(null);
|
||||
throw errState;
|
||||
}
|
||||
} else {
|
||||
this.log(transformed, chunks[i].callback);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Predicate function that returns true if the specfied `info` on the
|
||||
* WriteReq, `write`, should be passed down into the derived
|
||||
* TransportStream's I/O via `.log(info, callback)`.
|
||||
* @param {WriteReq} write - winston@3 Node.js WriteReq for the `info` object
|
||||
* representing the log message.
|
||||
* @returns {Boolean} - Value indicating if the `write` should be accepted &
|
||||
* logged.
|
||||
*/
|
||||
TransportStream.prototype._accept = function _accept(write) {
|
||||
const info = write.chunk;
|
||||
if (this.silent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We always prefer any explicit level set on the Transport itself
|
||||
// falling back to any level set on the parent.
|
||||
const level = this.level || (this.parent && this.parent.level);
|
||||
|
||||
// Immediately check the average case: log level filtering.
|
||||
if (
|
||||
info.exception === true ||
|
||||
!level ||
|
||||
this.levels[level] >= this.levels[info[LEVEL]]
|
||||
) {
|
||||
// Ensure the info object is valid based on `{ exception }`:
|
||||
// 1. { handleExceptions: true }: all `info` objects are valid
|
||||
// 2. { exception: false }: accepted by all transports.
|
||||
if (this.handleExceptions || info.exception !== true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* _nop is short for "No operation"
|
||||
* @returns {Boolean} Intentionally false.
|
||||
*/
|
||||
TransportStream.prototype._nop = function _nop() {
|
||||
// eslint-disable-next-line no-undefined
|
||||
return void undefined;
|
||||
};
|
52
node_modules/winston-transport/package.json
generated
vendored
Normal file
52
node_modules/winston-transport/package.json
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "winston-transport",
|
||||
"description": "Base stream implementations for winston@3 and up.",
|
||||
"version": "4.8.0",
|
||||
"main": "index.js",
|
||||
"browser": "dist/index.js",
|
||||
"scripts": {
|
||||
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint test/*.js index.js --resolve-plugins-relative-to ./node_modules/@dabh/eslint-config-populist",
|
||||
"pretest": "npm run lint && npm run build",
|
||||
"test": "nyc mocha test/*.test.js",
|
||||
"report": "nyc report --reporter=lcov",
|
||||
"build": "rimraf dist && babel *.js -d ./dist",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:winstonjs/winston-transport.git"
|
||||
},
|
||||
"keywords": [
|
||||
"winston",
|
||||
"transport",
|
||||
"winston3"
|
||||
],
|
||||
"author": "Charlie Robbins <charlie.robbins@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/winstonjs/winston-transport/issues"
|
||||
},
|
||||
"homepage": "https://github.com/winstonjs/winston-transport#readme",
|
||||
"dependencies": {
|
||||
"logform": "^2.6.1",
|
||||
"readable-stream": "^4.5.2",
|
||||
"triple-beam": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.6.0",
|
||||
"abstract-winston-transport": ">=0.5.1",
|
||||
"assume": "^2.3.0",
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"deep-equal": "^2.0.5",
|
||||
"eslint": "^9.6.0",
|
||||
"@dabh/eslint-config-populist": "^4.4.0",
|
||||
"mocha": "^10.6.0",
|
||||
"nyc": "^17.0.0",
|
||||
"rimraf": "^6.0.1",
|
||||
"winston-compat": "^0.1.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue