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


TypeScript util.scopedLogger函数代码示例

本文整理汇总了TypeScript中@hpcc-js/util.scopedLogger函数的典型用法代码示例。如果您正苦于以下问题:TypeScript scopedLogger函数的具体用法?TypeScript scopedLogger怎么用?TypeScript scopedLogger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: scopedLogger

import { join, promiseTimeout, scopedLogger } from "@hpcc-js/util";

const logger = scopedLogger("comms/connection.ts");

export type RequestType = "post" | "get" | "jsonp";
export type ResponseType = "json" | "text";

export type IOptionsSend = (options: IOptions, action: string, request: any, responseType: ResponseType, defaultSend: SendFunc, header?: any) => Promise<any>;
export interface IOptions {
    baseUrl: string;
    type?: RequestType;
    userID?: string;
    password?: string;
    rejectUnauthorized?: boolean;
    timeoutSecs?: number;
    hookSend?: IOptionsSend;
}
export function instanceOfIOptions(object: any): object is IOptions {
    return "baseUrl" in object;
}

const DefaultOptions: IOptions = {
    type: "post",
    baseUrl: "",
    userID: "",
    password: "",
    rejectUnauthorized: true,
    timeoutSecs: 60
};

export interface IConnection {
开发者ID:GordonSmith,项目名称:Visualization,代码行数:31,代码来源:connection.ts

示例2: scopedLogger

import { expect } from "chai";

import { Workunit } from "@hpcc-js/comms";
import { scopedLogger } from "@hpcc-js/util";
import { ESP_URL, isTravis } from "../testLib";

const logger = scopedLogger("test/workunit");
const WUID = "W20170510-114044";

describe("test/esp/ecl/Workunit", function () {
    this.timeout(30000);
    describe("simple life cycle", function () {
        let wu1: Workunit;
        it("creation", function () {
            return Workunit.create({
                baseUrl: ESP_URL,
                hookSend: (options, action, request, responseType, defaultSend, header?: any) => {
                    return defaultSend(options, action, request, responseType, { ...header, myCreds: "007-shhh" });
                }
            }).then((wu) => {
                expect(wu).exist;
                expect(wu.Wuid).exist;
                wu1 = wu;
                return wu;
            });
        });
        it("update", function () {
            return wu1.update({
                QueryText: `
Layout_Person := RECORD
    UNSIGNED1 PersonID;
开发者ID:GordonSmith,项目名称:Visualization,代码行数:31,代码来源:workunit.spec.ts

示例3: scopedLogger

import { expect } from "chai";

import { Level, scopedLogger } from "@hpcc-js/util";

const logger = scopedLogger("test/util/logging.ts");

describe("util/logging.ts", function () {
    it("basic", function () {
        expect(logger).exist;
        logger.debug("debug test");
        logger.info("info test");
        logger.notice("notice test");
        logger.warning("warning test");
        logger.error("error test");
        logger.critical("critical test");
        logger.alert("alert test");
        logger.emergency("emergency test");
    });
    it("basic", function () {
        expect(logger).exist;
        logger.pushLevel(Level.error);
        logger.debug("should not show");
        logger.warning("should not show");
        logger.error("should show");
        logger.emergency("should show");
        logger.popLevel();
        logger.debug("should show");
        logger.warning("should show");
        logger.error("should show");
        logger.emergency("should show");
    });
开发者ID:GordonSmith,项目名称:Visualization,代码行数:31,代码来源:logging.spec.ts


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