當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。