Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nestjs-pino

Package Overview
Dependencies
Maintainers
1
Versions
1332
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-pino - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

4

dist/Logger.d.ts
import { LoggerService } from "@nestjs/common";
import { PinoLogger } from "./PinoLogger";
import { Params } from "./params";
export declare class Logger implements LoggerService {
private readonly logger;
constructor(logger: PinoLogger);
private readonly contextName;
constructor(logger: PinoLogger, { renameContext }: Params);
verbose(message: any, context?: string, ...args: any[]): void;

@@ -7,0 +9,0 @@ debug(message: any, context?: string, ...args: any[]): void;

@@ -11,12 +11,17 @@ "use strict";

};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
const common_1 = require("@nestjs/common");
const PinoLogger_1 = require("./PinoLogger");
const constants_1 = require("./constants");
let Logger = class Logger {
constructor(logger) {
constructor(logger, { renameContext }) {
this.logger = logger;
this.contextName = renameContext || "context";
}
verbose(message, context, ...args) {
if (context) {
this.logger.trace({ context }, message, ...args);
this.logger.trace({ [this.contextName]: context }, message, ...args);
}

@@ -29,3 +34,3 @@ else {

if (context) {
this.logger.debug({ context }, message, ...args);
this.logger.debug({ [this.contextName]: context }, message, ...args);
}

@@ -38,3 +43,3 @@ else {

if (context) {
this.logger.info({ context }, message, ...args);
this.logger.info({ [this.contextName]: context }, message, ...args);
}

@@ -47,3 +52,3 @@ else {

if (context) {
this.logger.warn({ context }, message, ...args);
this.logger.warn({ [this.contextName]: context }, message, ...args);
}

@@ -56,3 +61,3 @@ else {

if (context) {
this.logger.error({ context, trace }, message, ...args);
this.logger.error({ [this.contextName]: context, trace }, message, ...args);
}

@@ -69,5 +74,6 @@ else if (trace) {

common_1.Injectable(),
__metadata("design:paramtypes", [PinoLogger_1.PinoLogger])
__param(1, common_1.Inject(constants_1.PARAMS_PROVIDER_TOKEN)),
__metadata("design:paramtypes", [PinoLogger_1.PinoLogger, Object])
], Logger);
exports.Logger = Logger;
//# sourceMappingURL=Logger.js.map

@@ -13,2 +13,3 @@ import * as pinoHttp from "pino-http";

useExisting?: true;
renameContext?: string;
}

@@ -15,0 +16,0 @@ export interface LoggerModuleAsyncParams extends Pick<ModuleMetadata, "imports" | "providers"> {

@@ -8,3 +8,4 @@ import * as pino from "pino";

private context;
constructor({ pinoHttp }: Params);
private readonly contextName;
constructor({ pinoHttp, renameContext }: Params);
trace(msg: string, ...args: any[]): void;

@@ -11,0 +12,0 @@ trace(obj: object, msg?: string, ...args: any[]): void;

@@ -28,3 +28,3 @@ "use strict";

let PinoLogger = class PinoLogger {
constructor({ pinoHttp }) {
constructor({ pinoHttp, renameContext }) {
this.context = "";

@@ -42,2 +42,3 @@ if (!outOfContext) {

}
this.contextName = renameContext || "context";
}

@@ -70,6 +71,9 @@ trace(...args) {

if (typeof firstArg === "object") {
args = [Object.assign({ context }, firstArg), ...args.slice(1)];
args = [
Object.assign({ [this.contextName]: context }, firstArg),
...args.slice(1)
];
}
else {
args = [{ context }, ...args];
args = [{ [this.contextName]: context }, ...args];
}

@@ -76,0 +80,0 @@ }

{
"name": "nestjs-pino",
"version": "1.0.2",
"version": "1.1.0",
"description": "Pino logger for NestJS",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -227,2 +227,10 @@ <p align="center">

useExisting?: true;
/**
* Optional parameter to change property name `context` in resulted logs,
* so logs will be like:
* {"level":30, ... "RENAME_CONTEXT_VALUE_HERE":"AppController" }
* Works with both `Logger` and `PinoLogger`
*/
renameContext?: string;
}

@@ -229,0 +237,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc