FIX. Исправление даты логов

This commit is contained in:
vigdorov
2020-08-13 21:40:46 +03:00
parent 370787a355
commit d1d67ba27e
2 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ const saveLog = (
response: any, response: any,
startTime: string, startTime: string,
) => { ) => {
const endTime = moment().utc().format(); const endTime = moment().format();
const error = new ErrorModel({ const error = new ErrorModel({
type, type,
request: request, request: request,
@ -41,7 +41,7 @@ const saveLog = (
@Injectable() @Injectable()
export class LoggingInterceptor implements NestInterceptor { export class LoggingInterceptor implements NestInterceptor {
intercept(context: ExecutionContext, next: CallHandler): Observable<any> { intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
const start = moment().utc().format(); const start = moment().format();
const args = context.getArgs()?.[0] ?? {}; const args = context.getArgs()?.[0] ?? {};
const {headers, url, method, body} = args; const {headers, url, method, body} = args;
const request = { const request = {

View File

@ -24,7 +24,7 @@ const errorSchema = new mongoose.Schema({
const ErrorModel = mongoose.model(LOG_TYPE.SERVER, errorSchema); const ErrorModel = mongoose.model(LOG_TYPE.SERVER, errorSchema);
const saveError = (type: string, message: string, trace = '') => { const saveError = (type: string, message: string, trace = '') => {
const date = moment().utc().format(); const date = moment().format();
const error = new ErrorModel({ const error = new ErrorModel({
type, message, trace, date type, message, trace, date
}); });