當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript inversify-logger-middleware.makeLoggerMiddleware函數代碼示例

本文整理匯總了TypeScript中inversify-logger-middleware.makeLoggerMiddleware函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript makeLoggerMiddleware函數的具體用法?TypeScript makeLoggerMiddleware怎麽用?TypeScript makeLoggerMiddleware使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了makeLoggerMiddleware函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getLogger

function getLogger(
    addLogEntry: (entry: interfaces.SelectableLogEntry, logSize: number) => void,
    initSettings: (settings: interfaces.UserSettings) => void,
    dispatch: Redux.Dispatch
): inversify.interfaces.Middleware {

    let settings = getSettings();

    dispatch(initSettings(settings));

    let reduxRenderer = function(entry: inversifyLoggerMiddleware.interfaces.LogEntry) {
        dispatch(addLogEntry(new SelectableLogEntry(entry), getSettings().size));
    };

    let middleware = makeLoggerMiddleware(settings, reduxRenderer);
    return middleware;
}
開發者ID:inversify,項目名稱:inversify-devtools,代碼行數:17,代碼來源:logger.ts

示例2: makeLoggerMiddleware

            factory: true,
            implementationType: true,
            onActivation: true,
            provider: true,
            scope: true,
            serviceIdentifier: true,
            type: true
        },
        serviceIdentifier: true,
        target: {
            metadata: true,
            name: true,
            serviceIdentifier: true
        }
    },
    time: true
};

let logger = makeLoggerMiddleware();
kernel.applyMiddleware(logger);

let loggerOutput1: LoggerOutput<string> = { entry: null };
let stringRenderer1 = makeStringRenderer(loggerOutput1);
let logger1 = makeLoggerMiddleware(options, stringRenderer1);
kernel.applyMiddleware(logger1);

let loggerOutput2: LoggerOutput<inversifyLoggerMiddleware.interfaces.LogEntry> = { entry: null };
let objRenderer2 = makeObjRenderer(loggerOutput2);
let logger2 = makeLoggerMiddleware(options, objRenderer2);
kernel.applyMiddleware(logger2);
開發者ID:lukas-zech-software,項目名稱:inversify-dts,代碼行數:30,代碼來源:inversify-logger-middleware-tests.ts

示例3: Kernel

import { Kernel } from 'inversify';
import { makeLoggerMiddleware } from 'inversify-logger-middleware';
import * as bodyParser from 'body-parser';
import * as helmet from 'helmet';
import TYPES from './constant/types';
import TAGS from './constant/tags';
import { HomeController } from './controller/home';
import { MongoDBClient } from './utils/mongodb/client';
import { UserController } from './controller/user';
import { UserService } from './service/user';

// load everything needed to the kernel
let kernel = new Kernel();

if (process.env.NODE_ENV === 'development') {
    let logger = makeLoggerMiddleware();
    kernel.applyMiddleware(logger);
}

kernel.bind<interfaces.Controller>(TYPE.Controller).to(HomeController).whenTargetNamed(TAGS.HomeController);
kernel.bind<interfaces.Controller>(TYPE.Controller).to(UserController).whenTargetNamed(TAGS.UserController);
kernel.bind<MongoDBClient>(TYPES.MongoDBClient).to(MongoDBClient);
kernel.bind<UserService>(TYPES.UserService).to(UserService);

// start the server
let server = new InversifyExpressServer(kernel);
server.setConfig((app) => {
  app.use(bodyParser.urlencoded({
    extended: true
  }));
  app.use(bodyParser.json());
開發者ID:codyjs,項目名稱:inversify-express-example,代碼行數:31,代碼來源:bootstrap.ts


注:本文中的inversify-logger-middleware.makeLoggerMiddleware函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。