3.0.0 • Published 9 months ago

@trxn/nestjs-winston v3.0.0

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
9 months ago

nestjs-winston

This library is intend to provide some helpful function to work with the stack's logger and winston. Be sure to read the logger documentation before to read this doc.

This library provide a wrapper around winston take the input from nestjs and format them correctly to be ingested by winston. It provide a function helper to instantiate and pass the class to nestjs.

Next to that this package provide a winston format helper to output the logs like nestjs when you are in development.

Configure your nestjs app

An example of how to use the two helpers

import {
  createWinstonLogger,
  nestLikeConsoleFormat,
} from '@trxn/nestjs-winston';

// Bootstrap the main application
async function bootstrap() {
  const logger = createWinstonLogger({
    // options (same as WinstonModule.forRoot() options)
    level,
    format: development
      ? nestLikeConsoleFormat('Stack', { prettyPrint: true })
      : ecsFormat(),
    transports: [new winston.transports.Console()],
  });

  // Instantiate nest app
  const app = await NestFactory.create(AppModule, {
    logger,
  });

  // Bonus to use winston with morgan:
  app.use(
    morgan('combined', {
      stream: { write: (str: string) => logger.log(str) },
    }),
  );

  await app.listen(3000);
}

Running unit tests

Run nx test nestjs-winston to execute the unit tests via Jest.

Credits

Credits to nest-winston.

2.2.7

10 months ago

3.0.0

9 months ago

2.2.5

11 months ago

2.2.1

11 months ago

2.2.0

11 months ago

2.2.3

11 months ago

2.2.2

11 months ago

2.2.4

11 months ago

2.1.22-next.5

12 months ago

2.1.22-next.3

12 months ago

2.1.22-next.4

12 months ago

2.1.22-next.1

12 months ago

2.1.22-next.2

12 months ago

2.1.22-next.0

12 months ago

2.1.9

1 year ago

2.1.12

1 year ago

2.1.10

1 year ago

2.1.11

1 year ago

2.1.4

1 year ago

2.1.6

1 year ago

2.1.5

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.1.0-next.1

1 year ago

2.1.0-next.0

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.3

1 year ago

2.1.0

1 year ago

2.0.11-next.1

1 year ago

2.0.11-next.0

1 year ago

2.0.11-next.3

1 year ago

2.0.11-next.2

1 year ago

2.0.13

1 year ago

2.0.11

1 year ago

2.0.12

1 year ago

2.0.9

1 year ago

2.0.10

1 year ago

2.0.8

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.0-next.2

1 year ago

2.0.0-next.0

1 year ago

2.0.0-next.1

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.65.13-next.4

1 year ago

1.65.13-next.5

1 year ago

1.65.11-beta.3

1 year ago

1.65.3

1 year ago

1.65.13-next.2

1 year ago

1.65.4

1 year ago

1.65.5

1 year ago

1.65.13-next.8

1 year ago

1.65.6

1 year ago

1.65.11-next.0

1 year ago

1.65.7

1 year ago

1.65.13-next.6

1 year ago

1.65.8

1 year ago

1.65.13-next.7

1 year ago

1.65.9

1 year ago

1.65.10

1 year ago

1.65.12

1 year ago

1.65.11

1 year ago

1.65.13-next.0

1 year ago

1.65.11-beta.0

1 year ago

1.65.13-next.1

1 year ago

1.65.11-beta.2

1 year ago

1.65.11-beta.1

1 year ago

1.65.2

1 year ago