• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript debug类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: return

    return (target: any) => {
        const isValid = target.prototype.isValid;
        const debug = _debug(`demgel-mvc:model:${target.name}`);

        const newIsValid: Function = function () {
            debug('validating model...');
            const required: Array<string> = Reflect.getMetadata('required-property', target.prototype) || [];
            this.errors.clear();
            required.forEach(req => {
                if (!this[req]) {
                    this.errors.set(`required:${req}`, `${req} is required.`);
                }
            });
            debug(`found ${this.errors.size} required errors`);

            // tslint:disable-next-line:max-line-length
            const validationErrors: Map<string, string> = Reflect.getMetadata('validation-errors', target.prototype) || new Map<string, string>();
            debug(`found ${validationErrors.size} validation errors`);
            validationErrors.forEach((value, key) => {
                if (!this.errors.has(key)) {
                    debug('setting validation error');
                    this.errors.set(key, value);
                }
            });
            return isValid.apply(this);
        };

        target.prototype.isValid = newIsValid;

        return target;
    };
开发者ID:DemgelOpenSource,项目名称:demgel-validation,代码行数:31,代码来源:model.ts


示例2: debug

 server.on("listening", () => {
   const addr = server.address();
   const bind =
     typeof addr === "string" ? `pipe ${addr}` : `port ${addr.port}`;
   debug(`Listening on ${bind}`);
   console.log(`Listening on ${bind}`);
 });
开发者ID:frankhale,项目名称:toby,代码行数:7,代码来源:server.ts


示例3: onListening

 /**
  * Event listener for HTTP server "listening" event.
  */
 function onListening() {
     let addr = server.address();
     let bind = typeof addr === "string"
     ? "pipe " + addr
     : "port " + addr.port;
     let debugForExpress = debug("ExpressApplication");
     debugForExpress("Listening on " + bind);
 }
开发者ID:rajajhansi,项目名称:aspnetcore-aurelia-tutorial,代码行数:11,代码来源:express-application.ts


示例4: onListening

  private onListening() {

    const debug = debugModule('express:server');
    if (_.isFunction(this.onListen)) this.onListen(this.port);
    let addr = this.server.address();
    let bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;
    debug('Listening on ' + bind);

  }
开发者ID:thehachez,项目名称:maduk,代码行数:9,代码来源:app.ts


示例5: default

export default (namespace: string, emoji) => {
  const debug = _debug(namespace);
  return (...args: any[]) => {
    args.push('\n');
    debug(`\n  ${emoji}  %s`, ...args.map(
      arg =>  preetfy(String(arg))
    ));
  };
};
开发者ID:ArtemGovorov,项目名称:reactjs-hackathon-kit,代码行数:9,代码来源:debug.ts


示例6: function

export default function (name?: string) {
  if (name) {
    const log = debug(`${pkg.name} (${name})`);
    log('ok')
    return function (formatter: any, ...argsarr: any[]) {
      const args = Array.prototype.slice.call(arguments);

      args[0] = `${new Date().toISOString()} - ${args[0]}`;

      log.apply(log, args);
    };
  } else {
    const log = debug(`${pkg.name}`);
    return function (formatter: any, ...argsarr: any[]) {
      const args = Array.prototype.slice.call(arguments);

      args[0] = `${new Date().toISOString()} - ${args[0]}`;

      log.apply(log, args);
    };
  }
};
开发者ID:evanshortiss,项目名称:obd-parser,代码行数:22,代码来源:log.ts


示例7: Debug

export const Logger = (scope: string) => {
    const scopeDebug = Debug(scope);
    return {
        debug: (message: string, ...args: any[]) => {
            if (Environment.isProduction()) {
                logger.debug(format(scope, message), parse(args));
            }
            scopeDebug(message, parse(args));
        },
        verbose: (message: string, ...args: any[]) => logger.verbose(format(scope, message), parse(args)),
        silly: (message: string, ...args: any[]) => logger.silly(format(scope, message), parse(args)),
        info: (message: string, ...args: any[]) => logger.info(format(scope, message), parse(args)),
        warn: (message: string, ...args: any[]) => logger.warn(format(scope, message), parse(args)),
        error: (message: string, ...args: any[]) => logger.error(format(scope, message), parse(args))
    };
};
开发者ID:w3tecch,项目名称:node-ts-boilerplate,代码行数:16,代码来源:Logger.ts


示例8: LoggerMock

export function LoggerMock(name: string): Ha4usLogger {
  const debug = Debug('ha4us:test:' + name)

  /* istanbul ignore next */
  function log(level: string) {
    return (...val: any[]) => {
      debug(level, ...val)
    }
  }

  return {
    silly: log('silly'),
    debug: log('debug'),
    info: log('info'),
    warn: log('warn'),
    error: log('error'),
  }
}
开发者ID:ha4us,项目名称:ha4us.old,代码行数:18,代码来源:logger.mock.ts


示例9: function

export default function(module: string) {

  // set up logging
  const log = debug(module);

  if (!log.enabled) {
    // logging not enabled for this module, return do-nothing middleware
    return (context: any, next: () => void) => next();
  }

  /* istanbul ignore next */
  return async (context: any, next: () => void) => {

    const startTime = Date.now();
    const { method, url } = context.request;

    await next();

    const status = parseInt(context.status, 10);
    const requestBody = context.request.body === undefined ? undefined : JSON.stringify(context.request.body);
    const responseBody = context.body === undefined ? undefined : JSON.stringify(context.body);
    const time = Date.now() - startTime;

    if (requestBody !== undefined && responseBody !== undefined) {
      log(`${method} ${url} ${requestBody} -> ${status} ${responseBody} ${time}ms`);
    }

    if (requestBody !== undefined && responseBody === undefined) {
      log(`${method} ${url} ${requestBody} -> ${status} ${time}ms`);
    }

    if (requestBody === undefined && responseBody !== undefined) {
      log(`${method} ${url} -> ${status} ${responseBody} ${time}ms`);
    }

    if (requestBody === undefined && responseBody === undefined) {
      log(`${method} ${url} -> ${status} ${time}ms`);
    }
  };
}
开发者ID:carlansley,项目名称:swagger2-koa,代码行数:40,代码来源:debug.ts


示例10: onListening

function onListening(): void {
  const addr = server.address();
  var bind = typeof addr === 'string'
    ? 'pipe ' + addr
    : 'port ' + addr.port;
  Debug('Listening on ' + bind);
}
开发者ID:yasupeke,项目名称:niconico-desktop-server,代码行数:7,代码来源:www.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript decamelize类代码示例发布时间:2022-05-28
下一篇:
TypeScript dayjs类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap