
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
winston-sentry-log
Advanced tools
Sentry transport for the winston v3 logger using @sentry/node.
yarn add winston winston-sentry-log
You can configure winston-sentry-log
in two different ways.
With winston.createLogger
:
import winston from 'winston';
import Sentry from 'winston-sentry-log';
const options = {
config: {
dsn: "https://******@sentry.io/12345"
},
level: "info"
};
const logger = winston.createLogger({
transports: [new Sentry(options)]
});
Or with winston's add
method:
import winston from 'winston';
import Sentry from 'winston-sentry-log';
const logger = winston.createLogger();
logger.add(Sentry, options);
See Options below for custom configuration.
options
)Per options
variable above, here are the default options provided:
Default Sentry options:
dsn
(String) - your Sentry DSN or Data Source Name (defaults to process.env.SENTRY_DSN
)Transport related options:
name
(String) - transport's name (defaults to winston-sentry-log
)silent
(Boolean) - suppress logging (defaults to false
)level
(String) - transport's level of messages to log (defaults to info
)levelsMap
(Object) - log level mapping to Sentry (see Log Level Mapping below)sentryClient
(Sentry) - the custom sentry client (defaults to require('@sentry/node')
)isClientInitialized
(boolean) - whether to initialize the provided sentry client or not (defaults to false
)
isClientInitialized
is set to true, a custom sentryClient
initialized must provided, otherwise internal sentryClient
will not initializedoptions.config
)logger
(String) - defaults to winston-sentry-log
server_name
(String) - defaults to process.env.SENTRY_NAME
or os.hostname()
release
(String) - defaults to process.env.SENTRY_RELEASE
environment
(String) - defaults to process.env.SENTRY_ENVIRONMENT
)modules
(Object) - defaults to package.json
dependenciesextra
(Object) - no default valuefingerprint
(Array) - no default valueFor a full list of Sentry options, please visit https://docs.sentry.io/clients/node/config/.
Winston logging levels are mapped by default to Sentry's acceptable levels.
These defaults are set as options.levelsMap
and are:
{
silly: 'debug',
verbose: 'debug',
info: 'info',
debug: 'debug',
warn: 'warning',
error: 'error'
}
You can customize how log levels are mapped using the levelsMap
option:
new Sentry({
levelsMap: {
verbose: "info"
}
});
If no log level mapping was found for the given level
passed, then it will not log anything.
FAQs
Winston transport for @sentry/node
The npm package winston-sentry-log receives a total of 6,429 weekly downloads. As such, winston-sentry-log popularity was classified as popular.
We found that winston-sentry-log demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.