diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-15 15:30:14 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-18 11:37:18 +0200 |
commit | 42b40636991b97fe818007fab19091764fc5db73 (patch) | |
tree | db431787c06ce898d22e91ff771f795219274fc6 /client/src/app/+admin/system | |
parent | 654d4ede7fa4d0faa71e49bcfab6b65a686397b2 (diff) | |
download | PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.gz PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.zst PeerTube-42b40636991b97fe818007fab19091764fc5db73.zip |
Add ability for client to create server logs
Diffstat (limited to 'client/src/app/+admin/system')
-rw-r--r-- | client/src/app/+admin/system/logs/log-row.model.ts | 7 | ||||
-rw-r--r-- | client/src/app/+admin/system/logs/logs.component.ts | 6 | ||||
-rw-r--r-- | client/src/app/+admin/system/logs/logs.service.ts | 4 |
3 files changed, 9 insertions, 8 deletions
diff --git a/client/src/app/+admin/system/logs/log-row.model.ts b/client/src/app/+admin/system/logs/log-row.model.ts index 615778210..e83c7b064 100644 --- a/client/src/app/+admin/system/logs/log-row.model.ts +++ b/client/src/app/+admin/system/logs/log-row.model.ts | |||
@@ -1,10 +1,11 @@ | |||
1 | import { LogLevel } from '@shared/models' | ||
2 | import omit from 'lodash-es/omit' | 1 | import omit from 'lodash-es/omit' |
2 | import { logger } from '@root-helpers/logger' | ||
3 | import { ServerLogLevel } from '@shared/models' | ||
3 | 4 | ||
4 | export class LogRow { | 5 | export class LogRow { |
5 | date: Date | 6 | date: Date |
6 | localeDate: string | 7 | localeDate: string |
7 | level: LogLevel | 8 | level: ServerLogLevel |
8 | message: string | 9 | message: string |
9 | meta: string | 10 | meta: string |
10 | 11 | ||
@@ -33,7 +34,7 @@ export class LogRow { | |||
33 | this.meta = JSON.stringify(message, null, 2) | 34 | this.meta = JSON.stringify(message, null, 2) |
34 | this.message = '' | 35 | this.message = '' |
35 | } catch (err) { | 36 | } catch (err) { |
36 | console.error('Cannot parse audit message.', err) | 37 | logger.error('Cannot parse audit message.', err) |
37 | } | 38 | } |
38 | } | 39 | } |
39 | } | 40 | } |
diff --git a/client/src/app/+admin/system/logs/logs.component.ts b/client/src/app/+admin/system/logs/logs.component.ts index 06237522a..939e710d7 100644 --- a/client/src/app/+admin/system/logs/logs.component.ts +++ b/client/src/app/+admin/system/logs/logs.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' |
2 | import { LocalStorageService, Notifier } from '@app/core' | 2 | import { LocalStorageService, Notifier } from '@app/core' |
3 | import { LogLevel } from '@shared/models' | 3 | import { ServerLogLevel } from '@shared/models' |
4 | import { LogRow } from './log-row.model' | 4 | import { LogRow } from './log-row.model' |
5 | import { LogsService } from './logs.service' | 5 | import { LogsService } from './logs.service' |
6 | 6 | ||
@@ -17,11 +17,11 @@ export class LogsComponent implements OnInit { | |||
17 | 17 | ||
18 | logs: LogRow[] = [] | 18 | logs: LogRow[] = [] |
19 | timeChoices: { id: string, label: string, dateFormat: string }[] = [] | 19 | timeChoices: { id: string, label: string, dateFormat: string }[] = [] |
20 | levelChoices: { id: LogLevel, label: string }[] = [] | 20 | levelChoices: { id: ServerLogLevel, label: string }[] = [] |
21 | logTypeChoices: { id: 'audit' | 'standard', label: string }[] = [] | 21 | logTypeChoices: { id: 'audit' | 'standard', label: string }[] = [] |
22 | 22 | ||
23 | startDate: string | 23 | startDate: string |
24 | level: LogLevel | 24 | level: ServerLogLevel |
25 | logType: 'audit' | 'standard' | 25 | logType: 'audit' | 'standard' |
26 | tagsOneOf: string[] = [] | 26 | tagsOneOf: string[] = [] |
27 | 27 | ||
diff --git a/client/src/app/+admin/system/logs/logs.service.ts b/client/src/app/+admin/system/logs/logs.service.ts index ea7e08b9b..933a074a8 100644 --- a/client/src/app/+admin/system/logs/logs.service.ts +++ b/client/src/app/+admin/system/logs/logs.service.ts | |||
@@ -3,7 +3,7 @@ import { catchError, map } from 'rxjs/operators' | |||
3 | import { HttpClient, HttpParams } from '@angular/common/http' | 3 | import { HttpClient, HttpParams } from '@angular/common/http' |
4 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
5 | import { RestExtractor, RestService } from '@app/core' | 5 | import { RestExtractor, RestService } from '@app/core' |
6 | import { LogLevel } from '@shared/models' | 6 | import { ServerLogLevel } from '@shared/models' |
7 | import { environment } from '../../../../environments/environment' | 7 | import { environment } from '../../../../environments/environment' |
8 | import { LogRow } from './log-row.model' | 8 | import { LogRow } from './log-row.model' |
9 | 9 | ||
@@ -22,7 +22,7 @@ export class LogsService { | |||
22 | isAuditLog: boolean | 22 | isAuditLog: boolean |
23 | startDate: string | 23 | startDate: string |
24 | tagsOneOf?: string[] | 24 | tagsOneOf?: string[] |
25 | level?: LogLevel | 25 | level?: ServerLogLevel |
26 | endDate?: string | 26 | endDate?: string |
27 | }): Observable<any[]> { | 27 | }): Observable<any[]> { |
28 | const { isAuditLog, startDate, endDate, tagsOneOf } = options | 28 | const { isAuditLog, startDate, endDate, tagsOneOf } = options |