本文整理汇总了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 {
示例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;
示例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");
});