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

TypeScript util.log函数代码示例

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

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



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

示例1: Date

  }, (err, stats) => {
    if (err) {
      console.error('Failed to create a production build. Reason:');
      console.error(err.message || err);
      process.exit(1);
    }

    console.log(stats.toString({
      chunks: false,
      colors: true
    }));

    const completionTime = Math.round((new Date().getTime() - startTime) / 1000 * 100) / 100;
    log('------------------------------------------');
    log(`=== Compilation and bundling completed in ${completionTime} sec.`);
    log('------------------------------------------');
    log('===== Waiting for changes... ======')
  })
开发者ID:botique-ai,项目名称:bigg-botique,代码行数:18,代码来源:bundleTypescriptAndWatch.ts


示例2: bundleTypescriptAndWatch

export function bundleTypescriptAndWatch({entries}) {
  const webpackEntry = {};

  entries.forEach((entry) => {
    webpackEntry['build/' + entry.name + '/bundle'] = entry.src;
  });

  config.entry = webpackEntry;

  const compiler = webpack(config);

  console.log();
  log('------------------------------------------');
  log(`===> Starting compilation and bundling... `);
  log('------------------------------------------');

  let startTime = new Date().getTime();

  compiler['plugin']('invalid', () => {
    log('==== Change detected. Compiling... =====');
    startTime = new Date().getTime();
  });

  compiler.watch({
    poll: true
  }, (err, stats) => {
    if (err) {
      console.error('Failed to create a production build. Reason:');
      console.error(err.message || err);
      process.exit(1);
    }

    console.log(stats.toString({
      chunks: false,
      colors: true
    }));

    const completionTime = Math.round((new Date().getTime() - startTime) / 1000 * 100) / 100;
    log('------------------------------------------');
    log(`=== Compilation and bundling completed in ${completionTime} sec.`);
    log('------------------------------------------');
    log('===== Waiting for changes... ======')
  })
}
开发者ID:botique-ai,项目名称:bigg-botique,代码行数:44,代码来源:bundleTypescriptAndWatch.ts


示例3: catch

                this._codecs.forEach((codec) => {
                    if (codec.context == context) {
                        let result = null;

                        try {
                            result = Hcp.decode(codec.id, this.toArrayBuffer(data), size);
                        } catch (error) {
                            util.log(JSON.stringify(error));
                            return;
                        }

                        try {
                            codec.receive(result);
                        } catch (error) {
                            util.log(JSON.stringify(error));
                        }

                        results.push(result);
                    }
                });
开发者ID:adamarvid,项目名称:hcp,代码行数:20,代码来源:hcp-node.ts


示例4: apply

    // see https://github.com/tutumcloud/haproxy
    //     https://serversforhackers.com/load-balancing-with-haproxy
    /**
     * Generate config and restart haproxy
     */
    async apply() {
        util.log("Generating new haproxy configuration file...");

        const config = await this.transform(false);
        if (config) {
            fs.writeFileSync(this.configFileName, config);
        }
        else {
            shell.rm(this.configFileName);
        }

        this.proxyManager.restart();
    }
开发者ID:Zenasoft,项目名称:vulcain-loadbalancer,代码行数:18,代码来源:template.ts


示例5: emitBinding

    /**
     * Emit front definition with ssl certificats list for all tenants
     * Bind on port 443 or port 80 in test mode
     */
    private async emitBinding(dryrun: boolean) {
        this.frontends.push("frontend vulcain");

        if (CONTEXT.isTest()) {
            this.frontends.push(`  bind *:80`);
            return true;
        }

        // Create certificates list for https binding
        let crtFileName = Path.join(this.proxyManager.engine.configurationsFolder, "list.crt");
        let crtList = this.def.wildcardDomains.map(this.createCertificateFileName.bind(this))

        let hasFrontEnds = false;

        if (this.def.rules) {
            for (const rule of this.def.rules) {
                hasFrontEnds = true;
                if (rule && rule.tlsDomain) {
                    let domainName = rule.tlsDomain;

                    try {
                        if (domainName) {
                            let fullName = this.createCertificateFileName(domainName);
                            if (crtList.indexOf(fullName) < 0) {
                                if (!dryrun) {
                                    // Ensures certificate exist
                                    await this.proxyManager.createCertificate(domainName, this.def.tlsEmail);
                                }
                                crtList.push(fullName);
                            }
                        }
                    }
                    catch (e) {
                        util.log("Certificate creation for domain " + domainName + " failed. " + e.message);
                    }
                }
            }
        }
        if (!dryrun) {
            fs.writeFileSync(crtFileName, crtList.join('\n'));
        }

        if (crtList.length > 0) {
            this.frontends.push(`  bind *:443 ssl crt-list ${crtFileName}`);
        }
        else {
            this.frontends.push(`  bind *:80`);
        }

        return hasFrontEnds;
    }
开发者ID:Zenasoft,项目名称:vulcain-loadbalancer,代码行数:55,代码来源:template.ts


示例6: next

 router.use((req: Request, res: Response, next: any)=> {
   util.log(util.format("Request to: %s:%s -- Params:%s",
     req.url, req.method, JSON.stringify(req.body)));
   res.setHeader('Access-Control-Allow-Credentials', "true");
   res.header("Access-Control-Allow-Origin", req.header("Origin"));
   res.header("Access-Control-Allow-Methods", "GET,POST,PUT,HEAD,DELETE,OPTIONS");
   res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
   if ('OPTIONS' == req.method) {
     res.sendStatus(200);
   }
   else {
     next();
   }
 });
开发者ID:twicepixels,项目名称:tp-main-api,代码行数:14,代码来源:app.router.ts


示例7: emitBackends

    private emitBackends(rule: RuleDefinition, aclIf: string, path: string, cx: number) {

        let serviceName = `${rule.serviceName.replace(/\./g, "-")}_${cx}`;
        let backend = "backend_" + serviceName;

        this.frontends.push("  use_backend " + backend + aclIf);

        this.backends.push("");
        this.backends.push("# " + rule.serviceName);
        this.backends.push("backend " + backend);

        this.backends.push("  option forwardfor");
        this.backends.push("  http-request set-header X-Forwarded-Port %[dst_port]");
        this.backends.push("  http-request add-header X-Forwarded-Proto https if { ssl_fc }");
        this.backends.push("  mode http");

        // Path rewriting
        if (rule.pathRewrite && path) {
            this.backends.push(`  http-request add-header x-vulcain-publicpath ${rule.path}`);
            let rw = rule.pathRewrite;
            let parts = rw.split(':');
            if (parts.length === 1) {
                // Replace path by pathRewrite
                this.backends.push("  reqrep ^([^\\ :]*)\\ " + path + "  \\1\\ " + rw + "\\2");
            } else if (parts.length === 2) {
                this.backends.push("  reqrep ^([^\\ :]*)\\ " + this.normalizeRegex(parts[0]) + "  \\1\\ " + this.normalizeRegex(parts[1]));
            }
            else {
                util.log(`Malformed rewriting path ${rw} is ignored for rule ${rule.id}`);
            }
        }

        if (rule.backendConfig) {
            let parts = rule.backendConfig.split(';').map(p => p && p.trim());
            parts.forEach(p => {
                if (p) {
                    this.backends.push(p);
                }
            });
        }
        this.backends.push("  server " + serviceName + " " + rule.serviceName + ":" + (rule.servicePort || "8080"));
    }
开发者ID:Zenasoft,项目名称:vulcain-loadbalancer,代码行数:42,代码来源:template.ts


示例8:

import * as util from "util";

util.log('Here is our TypeScript starter project for Node.js');
开发者ID:ChezCrawford,项目名称:ts-node-starter,代码行数:3,代码来源:app.ts


示例9: log

 compiler['plugin']('invalid', () => {
   log('==== Change detected. Compiling... =====');
   startTime = new Date().getTime();
 });
开发者ID:botique-ai,项目名称:bigg-botique,代码行数:4,代码来源:bundleTypescriptAndWatch.ts


示例10: require

import { Server } from './server';
import { EngineFactory } from './host';
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
//
//    Copyright (c) Zenasoft
//
const util = require('util');

// -------------------------------------------------------------------
// START
// -------------------------------------------------------------------
util.log("Vulcain load balancer - version 2.0.0");

process.on('unhandledRejection', function (reason, p) {
    console.log("Unhandled rejection at: Promise ", p, " reason: ", reason);
});

const engine = EngineFactory.createEngine();
const server = new Server(engine);
server.start();
开发者ID:Zenasoft,项目名称:vulcain-loadbalancer,代码行数:30,代码来源:index.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript util.promisify函数代码示例发布时间:2022-05-25
下一篇:
TypeScript util.is_armature函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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