mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -05:00
fix: migrate import code
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
a3232a816b
commit
39fff87f52
1 changed files with 8 additions and 8 deletions
|
@ -11,12 +11,12 @@ import {
|
||||||
Scope,
|
Scope,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { isObject } from '@nestjs/common/utils/shared.utils';
|
import { isObject } from '@nestjs/common/utils/shared.utils';
|
||||||
|
import { blue, cyanBright, green, magentaBright, red, yellow } from 'cli-color';
|
||||||
|
|
||||||
import appConfiguration, { AppConfig } from '../config/app.config';
|
import appConfiguration, { AppConfig } from '../config/app.config';
|
||||||
import { Loglevel } from '../config/loglevel.enum';
|
import { Loglevel } from '../config/loglevel.enum';
|
||||||
import { needToLog } from '../config/utils';
|
import { needToLog } from '../config/utils';
|
||||||
|
|
||||||
import clc = require('cli-color');
|
|
||||||
import DateTimeFormatOptions = Intl.DateTimeFormatOptions;
|
import DateTimeFormatOptions = Intl.DateTimeFormatOptions;
|
||||||
|
|
||||||
@Injectable({ scope: Scope.TRANSIENT })
|
@Injectable({ scope: Scope.TRANSIENT })
|
||||||
|
@ -44,7 +44,7 @@ export class ConsoleLoggerService implements LoggerService {
|
||||||
error(message: unknown, trace = '', functionContext?: string): void {
|
error(message: unknown, trace = '', functionContext?: string): void {
|
||||||
this.printMessage(
|
this.printMessage(
|
||||||
message,
|
message,
|
||||||
clc.red,
|
red,
|
||||||
this.makeContextString(functionContext),
|
this.makeContextString(functionContext),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
@ -55,7 +55,7 @@ export class ConsoleLoggerService implements LoggerService {
|
||||||
if (needToLog(this.appConfig.loglevel, Loglevel.INFO)) {
|
if (needToLog(this.appConfig.loglevel, Loglevel.INFO)) {
|
||||||
this.printMessage(
|
this.printMessage(
|
||||||
message,
|
message,
|
||||||
clc.green,
|
green,
|
||||||
this.makeContextString(functionContext),
|
this.makeContextString(functionContext),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
@ -66,7 +66,7 @@ export class ConsoleLoggerService implements LoggerService {
|
||||||
if (needToLog(this.appConfig.loglevel, Loglevel.WARN)) {
|
if (needToLog(this.appConfig.loglevel, Loglevel.WARN)) {
|
||||||
this.printMessage(
|
this.printMessage(
|
||||||
message,
|
message,
|
||||||
clc.yellow,
|
yellow,
|
||||||
this.makeContextString(functionContext),
|
this.makeContextString(functionContext),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
@ -77,7 +77,7 @@ export class ConsoleLoggerService implements LoggerService {
|
||||||
if (needToLog(this.appConfig.loglevel, Loglevel.DEBUG)) {
|
if (needToLog(this.appConfig.loglevel, Loglevel.DEBUG)) {
|
||||||
this.printMessage(
|
this.printMessage(
|
||||||
message,
|
message,
|
||||||
clc.magentaBright,
|
magentaBright,
|
||||||
this.makeContextString(functionContext),
|
this.makeContextString(functionContext),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
@ -88,7 +88,7 @@ export class ConsoleLoggerService implements LoggerService {
|
||||||
if (needToLog(this.appConfig.loglevel, Loglevel.TRACE)) {
|
if (needToLog(this.appConfig.loglevel, Loglevel.TRACE)) {
|
||||||
this.printMessage(
|
this.printMessage(
|
||||||
message,
|
message,
|
||||||
clc.cyanBright,
|
cyanBright,
|
||||||
this.makeContextString(functionContext),
|
this.makeContextString(functionContext),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
@ -155,7 +155,7 @@ export class ConsoleLoggerService implements LoggerService {
|
||||||
localeStringOptions,
|
localeStringOptions,
|
||||||
);
|
);
|
||||||
|
|
||||||
const contextMessage = context ? clc.blue(`[${context}] `) : '';
|
const contextMessage = context ? blue(`[${context}] `) : '';
|
||||||
const timestampDiff = this.updateAndGetTimestampDiff(isTimeDiffEnabled);
|
const timestampDiff = this.updateAndGetTimestampDiff(isTimeDiffEnabled);
|
||||||
|
|
||||||
process.stdout.write(
|
process.stdout.write(
|
||||||
|
@ -166,7 +166,7 @@ export class ConsoleLoggerService implements LoggerService {
|
||||||
private updateAndGetTimestampDiff(isTimeDiffEnabled?: boolean): string {
|
private updateAndGetTimestampDiff(isTimeDiffEnabled?: boolean): string {
|
||||||
const includeTimestamp = this.lastTimestamp && isTimeDiffEnabled;
|
const includeTimestamp = this.lastTimestamp && isTimeDiffEnabled;
|
||||||
const result = includeTimestamp
|
const result = includeTimestamp
|
||||||
? clc.yellow(` +${Date.now() - this.lastTimestamp}ms`)
|
? yellow(` +${Date.now() - this.lastTimestamp}ms`)
|
||||||
: '';
|
: '';
|
||||||
this.lastTimestamp = Date.now();
|
this.lastTimestamp = Date.now();
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue