当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript loggers.get方法代码示例

本文整理汇总了TypeScript中winston.loggers.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript loggers.get方法的具体用法?TypeScript loggers.get怎么用?TypeScript loggers.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在winston.loggers的用法示例。


在下文中一共展示了loggers.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

    constructor(browser: string, headlessMode: boolean = false, logger?: winston.Logger) {

        if(logger){
            this.logger =logger;
        }else {
            this.logger = winston.loggers.get('tasteeLog');
            this.logger.configure({
                level: 'info',
                format: winston.format.combine(
                    winston.format.colorize(),
                    winston.format.splat(),
                    winston.format.simple()
                  ),
                transports: [
                    new winston.transports.Console()
                ]
              });
        }

        if (browser) {
            let webdriver = require('selenium-webdriver');
            switch (browser) {
                case 'chrome':
                    if (headlessMode) {
                        var chrome = require('selenium-webdriver/chrome');
                        this.driver = new webdriver.Builder()
                            .withCapabilities(selenium.Capabilities.chrome())
                            .setChromeOptions(new chrome.Options().headless())
                            .build();
                    }
                    else {
                        this.driver = new webdriver.Builder()
                            .forBrowser('chrome')
                            .build();
                    }
                    break;
                case 'firefox':
                    if (headlessMode) {
                        var firefox = require('selenium-webdriver/firefox');
                        this.driver = new webdriver.Builder()
                            .withCapabilities(selenium.Capabilities.firefox())
                            .setFirefoxOptions(new firefox.Options().headless())
                            .build();
                    }
                    else {
                        this.driver = new webdriver.Builder()
                            .forBrowser('firefox')
                            .build();
                    }
                    break;
                default:
                    this.driver = new webdriver.Builder()
                        .forBrowser('phantomjs')
                        .build();
                    break;
            }
        }
        this.reporter = new TasteeReporter();
    }
开发者ID:tastee,项目名称:tastee-core,代码行数:59,代码来源:tastee-engine.ts

示例2: it

    it(" propagates logger", function () {
        const infoLog = winston.loggers.get('infoLog');
        infoLog.configure({
            level: 'info'
          });

        let engineInfo = new TasteeEngine(null, false, infoLog);
        expect(engineInfo.logger).toBe(infoLog);
    });
开发者ID:tastee,项目名称:tastee-core,代码行数:9,代码来源:tastee-engine.spec.ts

示例3: LogFactory

export function LogFactory($args): Ha4usLogger {
	winston.loggers.add($args.name, {
		console: {
			colorize: true,
			level: $args.loglevel,
			prettyPrint: true,
			stderrLevels: ['error', 'warn'],
			timestamp: true,
		},
	})
	return winston.loggers.get($args.name)
}
开发者ID:ha4us,项目名称:ha4us.old,代码行数:12,代码来源:log.factory.ts

示例4: require

require('winston-email');

var configuration = new config.Config;

winston.loggers.add('logger', {
    email: {
        from   : configuration.loggeremailfrom,
        to     : configuration.loggeremailto,
        service: configuration.loggeremailservice,
        auth   : configuration.loggeremailauth,
        tags   : configuration.loggeremailtags
    }
    // other transports
});

var logger = winston.loggers.get('logger');

export class BusinessLogic {

    postAjaj(url, objectToSend, cb) {

        var default_headers = {
            'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20100101 Firefox/7.0.1',
            'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
            'Accept-Language': 'en-us,en;q=0.5',
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
            // 'Connection': 'keep-alive',
            'Cache-Control': 'max-age=0',
            'Content-Type': "application/json; charset=utf-8"
        };
开发者ID:siliconplains44,项目名称:ldcontentstorm,代码行数:31,代码来源:bl.ts

示例5: function

/* tslint:disable:no-unused-variable */

import { TasteeEngine } from "../../app/tastee-engine";
import { Instruction } from "../../app/instruction";

import * as winston from "winston";
////////  SPECS  /////////////

const logger = winston.loggers.get('tasteeLog');

describe('Tastee Engine', function () {
    let engine: TasteeEngine;

    logger.configure({
        level: 'debug',
        format: winston.format.combine(
            winston.format.colorize(),
            winston.format.splat(),
            winston.format.simple()
          ),
        transports: [
            new winston.transports.Console()
        ]
      });

    beforeEach(function () {
        engine = new TasteeEngine(null);
        let driver = jasmine.createSpyObj("driver", ["quit"]);
        engine.driver = driver;
    });
开发者ID:tastee,项目名称:tastee-core,代码行数:30,代码来源:tastee-engine.spec.ts


注:本文中的winston.loggers.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。