{"id":14978656,"url":"https://github.com/jasonsoft/nestjs-seq","last_synced_at":"2025-04-06T13:10:14.184Z","repository":{"id":50932838,"uuid":"383051373","full_name":"jasonsoft/nestjs-seq","owner":"jasonsoft","description":"🐷 Seq logging module for Nest framework (node.js) ","archived":false,"fork":false,"pushed_at":"2024-04-24T03:11:23.000Z","size":1319,"stargazers_count":185,"open_issues_count":0,"forks_count":7,"subscribers_count":8,"default_branch":"v2.x.x","last_synced_at":"2025-03-30T10:09:42.268Z","etag":null,"topics":["nest","nestjs","nestjs-seq","seq","seq-logger","seq-logging"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jasonsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-05T07:24:10.000Z","updated_at":"2025-03-17T13:53:20.000Z","dependencies_parsed_at":"2023-11-15T09:30:18.495Z","dependency_job_id":"ad23928a-467d-4132-a3c4-87c2a964790b","html_url":"https://github.com/jasonsoft/nestjs-seq","commit_stats":{"total_commits":61,"total_committers":1,"mean_commits":61.0,"dds":0.0,"last_synced_commit":"3b0fbcaf4331c908bbc42e5453f4029bec5a6369"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsoft%2Fnestjs-seq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsoft%2Fnestjs-seq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsoft%2Fnestjs-seq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsoft%2Fnestjs-seq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonsoft","download_url":"https://codeload.github.com/jasonsoft/nestjs-seq/tar.gz/refs/heads/v2.x.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247485287,"owners_count":20946398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nest","nestjs","nestjs-seq","seq","seq-logger","seq-logging"],"created_at":"2024-09-24T13:58:08.784Z","updated_at":"2025-04-06T13:10:14.165Z","avatar_url":"https://github.com/jasonsoft.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/jasonsoft/\" target=\"blank\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/90173752?s=200\u0026v=4\" width=\"120\" alt=\"JasonSoft Logo\" /\u003e\u003c/a\u003e\n  \u003ca href=\"http://nestjs.com/\" target=\"blank\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/28507035?s=200\u0026v=4\" width=\"120\" alt=\"Nest Logo\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://datalust.co/\" target=\"blank\"\u003e\u003cimg src=\"https://datalust.co/img/seq-logo-dark.svg\" height=\"120\"  alt=\"datalust Logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# nestjs-seq\n\n🐷 Seq logging module for Nest framework (node.js)\n\n[![NPM version][npm-img]][npm-url]\n[![NPM Downloads][downloads-image]][npm-url]\n[![GitHub stars][stars-img]][github-url]\n[![License][license-img]][license-url]\n\n## Installation\n\n```bash\n# Using npm\n$ npm i --save @jasonsoft/nestjs-seq\n\n# Using yarn\n$ yarn add @jasonsoft/nestjs-seq\n\n# Using pnpm\n$ pnpm add @jasonsoft/nestjs-seq\n```\n\n## Quick Start\n\n\u003e After successfully installing the package, proceed to integrate the SeqLoggerModule into your project's root AppModule.\n\n### Static Configuration\n\n```js\nimport { Module } from '@nestjs/common';\nimport { AppController } from './app.controller';\nimport { AppService } from './app.service';\n/**\n * Import the SeqLoggerModule into the root AppModule to enable centralized logging.\n * This module is configured to connect to a Seq server for log aggregation and analysis.\n * It is essential for monitoring and debugging applications by collecting and storing logs.\n * Updated by Jason.Song (成长的小猪) on 2024/04/21\n * Added by Jason.Song (成长的小猪) on 2021/09/08\n */\nimport { SeqLoggerModule } from '@jasonsoft/nestjs-seq';\n\n@Module({\n  imports: [\n    /**\n     * Import and configure the SeqLoggerModule using the .forRoot() method.\n     * This method initializes the module with server-specific configurations,\n     * allowing for centralized management of log data across the application.\n     * Updated by Jason.Song (成长的小猪) on 2024/04/21\n     * Added by Jason.Song (成长的小猪) on 2021/09/08\n     */\n    SeqLoggerModule.forRoot({\n      /** Specifies the URL of the Seq server to which logs should be sent. */\n      serverUrl: 'http://localhost:5341',\n      /** Provides the API Key required for authenticating with the Seq server. */\n      apiKey: 'K7iUhZ9OSp6oX5EOCfPt',\n      /** Optional additional metadata properties */\n      extendMetaProperties: {\n        /** Defines a custom service name for the logs, aiding in their categorization and filtering.\n         * This name helps in identifying logs related to this service in a mixed-service environment.\n         */\n        serviceName: 'product-service',\n      },\n      /** For more configuration details, see the \"Seq Logger Options Documentation\" section below. */\n    }),\n  ],\n  controllers: [AppController],\n  providers: [AppService],\n})\nexport class AppModule {}\n```\n\n### Async Configuration\n\n```js\n// Import ConfigModule to manage application configuration through environment variables.\nimport { ConfigModule, ConfigService } from '@nestjs/config';\nimport { SeqLoggerModule } from '@jasonsoft/nestjs-seq';\n\n@Module({\n  imports: [\n    ConfigModule.forRoot(),\n    /**\n     * Asynchronously configure the SeqLoggerModule using the forRootAsync() method.\n     * This method allows module options to be passed asynchronously, leveraging factory providers\n     * that can be asynchronous and inject dependencies such as ConfigService.\n     * Updated by Jason.Song (成长的小猪) on 2024/04/21\n     * Added by Jason.Song (成长的小猪) on 2021/10/20\n     */\n    SeqLoggerModule.forRootAsync({\n      imports: [ConfigModule],\n      useFactory: async (configService: ConfigService) =\u003e ({\n        /** Specifies the HTTP/S endpoint address of the Seq server for log transmission. */\n        serverUrl: configService.get('SEQ_SERVER_URL'),\n        /** Provides the API Key required for authenticating with the Seq server. */\n        apiKey: configService.get('SEQ_API_KEY'),\n        /** Optional additional metadata properties to enhance log categorization and filtering. */\n        extendMetaProperties: {\n          /** Custom service name for the logs to assist in their categorization and filtering within a multi-service environment. */\n          serviceName: configService.get('SEQ_SERVICE_NAME'),\n        },\n        /** For more configuration details, see the \"Seq Logger Options Documentation\" section below. */\n      }),\n      inject: [ConfigService],\n    }),\n  ],\n  controllers: [AppController],\n  providers: [AppService],\n})\nexport class AppModule {}\n```\n\n### ✨ Seq Logger Options Documentation\n\nPlease refer to the [Seq Logger Options Documentation](SEQ_LOGGER_OPTIONS.md) for detailed explanations of the configuration options available for the Seq Logger. For immediate access to the document, click [here](SEQ_LOGGER_OPTIONS.md).\n\n## Usage\n\n```js\nimport { Controller, Get } from '@nestjs/common';\nimport { AppService } from './app.service';\n/**\n * Import the SeqLogger for structured logging.\n * This logger allows for easy tracking and querying of log data.\n * Updated by Jason.Song (成长的小猪) on 2024/04/21\n * Added by Jason.Song (成长的小猪) on 2021/09/08\n */\nimport { SeqLogger } from '@jasonsoft/nestjs-seq';\n\n@Controller()\nexport class AppController {\n  constructor(\n    /**\n     * Inject the Seq Logger service for structured logging.\n     * This service provides methods to log various levels of information (info, debug, error).\n     * Updated by Jason.Song (成长的小猪) on 2024/04/21\n     * Added by Jason.Song (成长的小猪) on 2021/09/08\n     */\n    private readonly logger: SeqLogger,\n    private readonly appService: AppService,\n  ) {}\n\n  @Get()\n  getHello(): string {\n    this.logger.info('getHello - start', AppController.name);\n\n    const result = this.appService.getHello();\n    this.logger.debug(\n      `Retrieving result from {name}`,\n      {\n        name: 'AppService',\n        result,\n        note: 'The message template function is used here',\n      },\n      AppController.name,\n    );\n\n    try {\n      throw new Error('Oops! Something whimsically wrong just happened!');\n    } catch (error: any) {\n      this.logger.error(error, AppController.name);\n      this.logger.error(\n        'The error has been successfully captured and handled!',\n        error,\n        AppController.name,\n      );\n\n      return result;\n    }\n  }\n}\n\n```\n\n### Seq\n\n\u003e Seq is a powerful centralized logging system. Explore the logs we have gathered:\n\n![Log Visualization](img/seq_2024.2.11282.jpg)\n\n## Nest System Console Logging to Seq\n\n\u003e This section describes how to integrate Nest system console logging with Seq through a custom console logger. To set up this integration, follow the steps below:\n\n```typescript\nimport { NestFactory } from '@nestjs/core';\nimport { AppModule } from './app.module';\n/**\n * Import the ConsoleSeqLogger to extend the built-in logger for supporting Seq.\n * Added by Jason.Song (成长的小猪) on 2021/09/24\n */\nimport { ConsoleSeqLogger } from '@jasonsoft/nestjs-seq';\n\nasync function bootstrap() {\n  /**\n   * Set bufferLogs to true to buffer all logs until the ConsoleSeqLogger is attached.\n   * This ensures that logs are captured during the application initialization.\n   * If initialization fails, Nest will use the default ConsoleLogger to output error messages.\n   */\n  const app = await NestFactory.create(AppModule, {\n    bufferLogs: true,\n  });\n\n  /**\n   * Use the ConsoleSeqLogger to extend the built-in logger functionality.\n   */\n  app.useLogger(app.get(ConsoleSeqLogger));\n\n  await app.listen(3000);\n}\nbootstrap();\n```\n\nThis setup allows your NestJS application to log directly to Seq, providing a centralized logging solution.\n\n\u003e Seq Interface Overview showing the integration of Nest System Console Logging with Seq.\n\n![Seq Interface Overview](img/console_seq_2024.2.11282.jpg)\n\n## Example Repository\n\nFor a practical implementation example, visit the [nestjs-seq-example repository on GitHub](https://github.com/jasonsoft-net/nestjs-seq-example).\n\n[npm-img]: https://img.shields.io/npm/v/@jasonsoft/nestjs-seq.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@jasonsoft/nestjs-seq\n[license-img]: https://img.shields.io/badge/license-MIT-green.svg?style=flat-square\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dt/@jasonsoft/nestjs-seq.svg?style=flat-square\n[project-icon]: https://avatars.githubusercontent.com/u/22167571?v=4\n[stars-img]: https://img.shields.io/github/stars/jasonsoft/nestjs-seq?style=social\n[github-url]: https://github.com/jasonsoft/nestjs-seq\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonsoft%2Fnestjs-seq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonsoft%2Fnestjs-seq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonsoft%2Fnestjs-seq/lists"}