jp.ms.common.modules 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jp.ms.common.modules",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,4 @@
1
+ export interface LogDto {
2
+ description: string;
3
+ stack?: string;
4
+ }
@@ -15,7 +15,7 @@ export class JpLoggerService extends ConsoleLogger {
15
15
  context: string;
16
16
  logLevel: LogLevel;
17
17
  writeStreamType?: "stdout" | "stderr";
18
- errorStack?: unknown
18
+ errorStack?: unknown,
19
19
  }) {
20
20
  const logObject = {
21
21
  level: options.logLevel,
@@ -1,11 +1,14 @@
1
- import { Controller, Get, Post, Res } from '@nestjs/common';
1
+ import { Body, Controller, Get, Headers, Inject, Post, Res } from '@nestjs/common';
2
2
  import type { Response } from 'express';
3
+ import { IAppHeaders } from 'jp.common.models';
3
4
 
4
5
  import { PlayerConnectedDto } from '../../dto/common/player-connected.dto';
6
+ import { JpLoggerService } from '../logger/jp-logger.service';
5
7
 
6
8
  import { SupportService } from './support.service';
7
9
  import { MetricService } from './metric.service';
8
10
  import { DumpService } from './dump.service';
11
+ import { LogDto } from '../../dto/common/log.dto';
9
12
 
10
13
  @Controller('support')
11
14
  export class SupportController {
@@ -13,6 +16,7 @@ export class SupportController {
13
16
  private readonly supportService: SupportService,
14
17
  private readonly metricService: MetricService,
15
18
  private readonly dumpService: DumpService,
19
+ @Inject() private readonly logger: JpLoggerService,
16
20
  ) {
17
21
  }
18
22
 
@@ -42,6 +46,15 @@ export class SupportController {
42
46
  }
43
47
 
44
48
  @Post('log')
45
- addLog () {
49
+ addLog (@Headers() headers: IAppHeaders, @Body() message: LogDto) {
50
+ this.logger.log({
51
+ client_auth_token: headers.client_auth_token,
52
+ client_game: headers.client_game,
53
+ client_channel: headers.client_channel,
54
+ client_language: headers.client_language,
55
+ client_version: headers.client_version,
56
+ description: message.description,
57
+ stack: message.stack,
58
+ });
46
59
  }
47
60
  }
@@ -13,8 +13,4 @@ export class SupportService {
13
13
  async getUsers (): Promise<Array<PlayerConnectedDto>> {
14
14
  return this.playersManager.getPlayers().map((item) => PlayerConnectedDto.fromEntities(item));
15
15
  }
16
-
17
- async getMetrics () {
18
-
19
- }
20
16
  }