
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@datalust/winston-seq
Advanced tools
winston-seq
A Winston v3 transport that sends structured logs to the Seq log server.
$ npm install @datalust/winston-seq winston
# Or with yarn
$ yarn add @datalust/winston-seq winston
const winston = require('winston');
const { SeqTransport } = require('@datalust/winston-seq');
// or import { SeqTransport } from '@datalust/winston-seq';
const logger = winston.createLogger({
level: 'info',
format: winston.format.combine( /* This is required to get errors to log with stack traces. See https://github.com/winstonjs/winston/issues/1498 */
winston.format.errors({ stack: true }),
winston.format.json(),
),
defaultMeta: { /* application: 'your-app-name' */ },
transports: [
new winston.transports.Console({
format: winston.format.simple(),
}),
new SeqTransport({
serverUrl: "https://your-seq-server:5341",
apiKey: "your-api-key",
onError: (e => { console.error(e) }),
handleExceptions: true,
handleRejections: true,
})
]
});
serverUrl
- the URL for your Seq server's ingestionapiKey
- (optional) The Seq API Key to useonError
- Callback to execute when an error occurs within the transporthandleExceptions
- (optional) Send an event when an uncaught exception occurshandleRejections
- (optional) Send an event when an unhandled promise rejection occursSend structured log events, with properties that can be used later for filtering and analysis:
logger.info("Hello {name}", {name: "World"});
Attach context by creating child loggers:
const taskLogger = logger.child({ activity: "purchase" });
taskLogger.debug(
"User {user} purchase product {product} at ${price}",
{
user: "Millie Gilbert",
product: "Yardtime Garden Shears",
price: 29.99
});
Install Yarn if you don't already have it. Next, add a .env
file with content like:
SEQ_INGESTION_URL=http://192.168.98.99:5341
SEQ_API_URL=http://192.168.98.99
SEQ_API_KEY=fsf7sa9f9sf7s9df7
Where SEQ_INGESTION_URL
is the ingestion address of a test Seq server, SEQ_API_URL
is the API address of the test server and SEQ_API_KEY
is an API key with the Ingest
and Read
permissions.
$ yarn build
$ yarn test
NB. One test will fail if the Seq server is configured to require an API key.
$ yarn test:coverage
$ yarn lint
FAQs
A Winston v3 transport for Seq
The npm package @datalust/winston-seq receives a total of 16,050 weekly downloads. As such, @datalust/winston-seq popularity was classified as popular.
We found that @datalust/winston-seq demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.