$ account winstonjs
Winston is a mature, widely-used logging library for Node.js. It provides a flexible, stream-based architecture where loggers are Transform streams and transports are Writable streams. The core Logger class accepts an `info` object (with `level` and `message`), passes it through a configurable format pipeline (from the `logform` package), and writes the result to one or more transports (e.g., Console, File, HTTP, Stream). The library supports custom log levels, child loggers, exception/rejection handling, profiling, and querying/streaming of logs. It is designed to be extensible: custom formats and transports can be created without modifying core code. External dependencies include `logform`, `winston-transport`, `triple-beam`, `safe-stable-stringify`, and `@dabh/diagnostics`. The codebase is well-structured, uses ES6 classes, and has comprehensive test coverage. It is actively maintained with regular releases and dependency updates.
winston-mongodb is a Node.js transport plugin that lets winston write log entries to MongoDB. When loaded via `require('winston-mongodb')`, it registers `winston.transports.MongoDB`. The transport accepts a MongoDB URI, a promise resolving to a MongoClient, or an existing client/db object; it creates the target collection (optionally capped), reconciles a TTL index on `timestamp` when `expireAfterSeconds` is set, and queues log/query/stream operations until the database is ready. Logging flattens winston's `info` object into a document with timestamp, level, message, optional hostname/label, and sanitized metadata. Internally, the code has a well-tested metadata sanitizer (`lib/helpers.js`) that clones arbitrary JS objects into MongoDB-safe form: it replaces `.` and `$` in keys, preserves Date/Buffer/ObjectId, converts Error into plain objects, and replaces circular references with `[Circular]`. The transport also supports querying and streaming logs: capped collections use a tailable cursor, while non-capped collections fall back to 2-second polling. The test suite uses `mongodb-memory-server`, the `abstract-winston-transport` conformance suite, and includes tests for connection flavors (URI, promise, Mongoose) and capped collections. Maintenance is currently active with CI across Node 20/22/24 and MongoDB 7/8, but code inspection shows some drift: the `silent` option calls the callback without returning and therefore still writes the log entry, a deprecation warning still says pre-connected object support 'will be removed in v5' although the package is at v7, and the query path uses `fields`/`background` options that are legacy in the current MongoDB driver. These are manageable rough edges rather than fundamental flaws.