当前位置: 首页>>代码示例>>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;未经允许,请勿转载。