Seq

This tutorials show you, how you can configure Seq logger with Ts.ED. Seq is centralized structured logs for NodeJS, .NET, Java etc.

Installation

Run this command to install required dependencies by @tsed/seq:

npm install --save @tsed/seq bunyan bunyan-seq @types/bunyan @types/bunyan-seq
1

Then add the following configuration in your :

import {ServerLoader, ServerSettings} from "@tsed/common";
import "@tsed/seq"; // import seq Ts.ED module

@ServerSettings({
  rootDir: __dirname,
  seq: {
    url: "http://localhost:5341"
  }
})
export class Server extends ServerLoader {

}
1
2
3
4
5
6
7
8
9
10
11
12

Note: Seq module use the ts-log-debug as a default system logger

Note: Seq module use the log level from the (default level is debug)

Example

import {Controller, Get, Post} from "@tsed/common";
import {$log} from "ts-log-debug";

@Controller('/calendars')
export class Calendar {
    
    @Get('/:id')
    async getCalendar(@QueryParam() id: string): Promise<CalendarModel> {
      $log.info(id);
    }
   
}
1
2
3
4
5
6
7
8
9
10
11
12

Then we should see the log in the Seq panel (by default localhost:5341)

Credits

Thanks to OskarLebuda to his contribution.