# LogIncomingRequestMiddleware Class

Module
import { LogIncomingRequestMiddleware } from "@tsed/common"
Source/packages/common/src/server/components/LogIncomingRequestMiddleware.ts

# Overview

class LogIncomingRequestMiddleware implements IMiddleware {
    protected injector: InjectorService;
    protected static DEFAULT_FIELDS: string[];
    constructor(injector: InjectorService);
    use(request: Req): void;
    $onResponse(request: Req, response: Res): void;
    protected onLogStart(request: Req): void;
    protected onLogEnd(request: Req, response: Res): void;
    protected configureRequest(request: Req): void;
    protected requestToObject(request: Req): any;
    protected minimalRequestPicker(request: Req): any;
}

# Members

protected injector: InjectorService

protected static DEFAULT_FIELDS: string[]

use(request: Req): void

Handle the request.


$onResponse(request: Req, response: Res): void

protected onLogStart(request: Req): void

The separate onLogStart() function will allow developer to overwrite the initial request log.


protected onLogEnd(request: Req, response: Res): void

Called when the $onResponse is called by Ts.ED (through Express.end).


protected configureRequest(request: Req): void

Attach all information that will be necessary to log the request. Attach a new request.log object.


protected requestToObject(request: Req): any

Return complete request info.


protected minimalRequestPicker(request: Req): any

Return a filtered request from global configuration.