![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
pino-sns-transport
Advanced tools
A pino v7+ transport for sending logs to AWS SNS.
It uses @aws-sdk/client-sns to send logs to sns topics.
npm install pino-sns-transport
import pino, { TransportTargetOptions } from 'pino';
import type { SnsTransportOptions } from 'pino-sns-transport';
const transportTargets: TransportTargetOptions[] = [
{
target: 'pino-sns-transport',
options: {
topicArn: process.env.TOPIC_ARN,
} as SnsTransportOptions,
level: 'warn',
},
];
const transport = pino.transport({
targets: transportTargets,
});
const logger = pino(
{
/**
* Set this to trace or the minimum from the logging
* levels of the transports so that all logs are
* forwarded to transports, each transport carries its
* own level and therefore can decide whether it wants
* to log or not
*/
level: 'trace',
},
transport,
)
import { SNSClientConfig } from "@aws-sdk/client-sns";
export type LogFilter = {
key: string;
pattern: RegExp,
}
export type SnsTransportOptions = {
snsClientConfig?: SNSClientConfig;
topicArn: string;
beautify?: boolean;
beautifyOptions?: {
indentSize?: number;
maxWidth?: number;
};
excludeKeys?: string[];
keyExamineDepth?: number;
includeLogs?: LogFilter[];
excludeLogs?: LogFilter[];
}
topicArn
is required and should the arn of the sns topic to publish logs to. It is passed to the publish method of the aws-sdk as issnsClientConfig
is optional and anything passed to it is forwarded directly to the aws-sdk thus making the underlying aws-sdk client transparently configurablebeautify
is true by default but will not take effect until the optional dependency json-beautify is also installed, if you happen to have the dependency for unrelated reasons and don't want your logs to be formatted you can turn it off herebeautifyOptions
are parameters passed to json-beautify and don't take effect until beautify
is true and the dependency is metexcludeKeys
can be used to delete keys from the json log before publish. Also supports dot notation for removing nested keys, see full example belowkeyExamineDepth
is the maximum depth level of json objects at which the keys will be examined for excludeKeys
. The default value is 3.includeLogs
can be used to filter for logs that need to published and discard the rest. Providing an empty array here has the same effect as not providing a value which is that all logs will be published unless filtered out by excludeLogs
. Unlike excludeKeys
, this does not support dot notation for nowexcludeLogs
can be used to prevent certain logs from being published whose value at key
matches the pattern
. Unlike excludeKeys
, this does not support dot notation for nowincludeLogs
and excludeLogs
are specified and a log matches both of them then it will be excluded.const transportTargets: TransportTargetOptions[] = [
{
target: 'pino-sns-transport',
options: {
topicArn: process.env.TOPIC_ARN,
excludeKeys: [
'pid',
'hostname',
'res.headers',
'req.headers',
'req.remoteAddress',
'req.remotePort',
],
excludeLogs: [
{
key: 'msg',
pattern: /Request (Completed|Errored)/,
},
{
key: 'context',
pattern: /ExceptionsHandler/,
},
],
} as SnsTransportOptions,
level: 'warn',
},
];
FAQs
Simple transport to publish logs to sns topics
The npm package pino-sns-transport receives a total of 3,246 weekly downloads. As such, pino-sns-transport popularity was classified as popular.
We found that pino-sns-transport demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.