diff --git a/src-ui/src/app/components/manage/logs/logs.component.html b/src-ui/src/app/components/manage/logs/logs.component.html index 82d82f991..f6738d373 100644 --- a/src-ui/src/app/components/manage/logs/logs.component.html +++ b/src-ui/src/app/components/manage/logs/logs.component.html @@ -1,12 +1,26 @@ + +
+ +
+ +
+
+

- {{log.created | date:'short'}} - {{getLevelText(log.level)}} - {{log.message}} + {{log.created | date:'short'}} + {{getLevelText(log.level)}} + {{log.message}}

\ No newline at end of file diff --git a/src-ui/src/app/components/manage/logs/logs.component.ts b/src-ui/src/app/components/manage/logs/logs.component.ts index 01da9dad2..0550e8151 100644 --- a/src-ui/src/app/components/manage/logs/logs.component.ts +++ b/src-ui/src/app/components/manage/logs/logs.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { kMaxLength } from 'buffer'; -import { LOG_LEVELS, PaperlessLog } from 'src/app/data/paperless-log'; +import { LOG_LEVELS, LOG_LEVEL_INFO, PaperlessLog } from 'src/app/data/paperless-log'; import { LogService } from 'src/app/services/rest/log.service'; @Component({ @@ -13,9 +13,14 @@ export class LogsComponent implements OnInit { constructor(private logService: LogService) { } logs: PaperlessLog[] = [] + level: number = LOG_LEVEL_INFO ngOnInit(): void { - this.logService.list(1, 50).subscribe(result => this.logs = result.results) + this.reload() + } + + reload() { + this.logService.list(1, 50, null, {'level__gte': this.level}).subscribe(result => this.logs = result.results) } getLevelText(level: number) { @@ -27,9 +32,18 @@ export class LogsComponent implements OnInit { if (this.logs.length > 0) { lastCreated = this.logs[this.logs.length-1].created } - this.logService.list(1, 25, null, {'created__lt': lastCreated}).subscribe(result => { + this.logService.list(1, 25, null, {'created__lt': lastCreated, 'level__gte': this.level}).subscribe(result => { this.logs.push(...result.results) }) } + getLevels() { + return LOG_LEVELS + } + + setLevel(id) { + this.level = id + this.reload() + } + } diff --git a/src-ui/src/app/data/paperless-log.ts b/src-ui/src/app/data/paperless-log.ts index 9c97975c2..61a6fce99 100644 --- a/src-ui/src/app/data/paperless-log.ts +++ b/src-ui/src/app/data/paperless-log.ts @@ -1,15 +1,15 @@ -export const DEBUG = 10 -export const INFO = 20 -export const WARNING = 30 -export const ERROR = 40 -export const CRITICAL = 50 +export const LOG_LEVEL_DEBUG = 10 +export const LOG_LEVEL_INFO = 20 +export const LOG_LEVEL_WARNING = 30 +export const LOG_LEVEL_ERROR = 40 +export const LOG_LEVEL_CRITICAL = 50 export const LOG_LEVELS = [ - {id: DEBUG, name: "DEBUG"}, - {id: INFO, name: "INFO"}, - {id: WARNING, name: "WARNING"}, - {id: ERROR, name: "ERROR"}, - {id: CRITICAL, name: "CRITICAL"} + {id: LOG_LEVEL_DEBUG, name: "DEBUG"}, + {id: LOG_LEVEL_INFO, name: "INFO"}, + {id: LOG_LEVEL_WARNING, name: "WARNING"}, + {id: LOG_LEVEL_ERROR, name: "ERROR"}, + {id: LOG_LEVEL_CRITICAL, name: "CRITICAL"} ] export interface PaperlessLog {