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


TypeScript plylog.getLogger函数代码示例

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


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

示例1: test

 test(testName, () => {
   new PolymerCli(['help', '--verbose']);
   let logger = logging.getLogger('TEST_LOGGER');
   // tslint:disable-next-line: no-any
   assert.equal((logger as any)['level'], 'debug');
   new PolymerCli(['help', '--quiet']);
   logger = logging.getLogger('TEST_LOGGER');
   // tslint:disable-next-line: no-any
   assert.equal((logger as any)['level'], 'error');
 });
开发者ID:Polymer,项目名称:tools,代码行数:10,代码来源:cli_test.ts

示例2: test

 test(testName, () => {
   const logger = logging.getLogger('TEST_LOGGER');
   new PolymerCli(['help', '--verbose']);
   assert.equal((logger as any)['level'], 'debug');
   new PolymerCli(['help', '--quiet']);
   assert.equal((logger as any)['level'], 'error');
 });
开发者ID:abdonrd,项目名称:polymer-cli,代码行数:7,代码来源:cli_test.ts

示例3: createGithubGenerator

/*
 * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
 */

import * as fs from 'fs';
import {Github} from '../github/github';
import * as path from 'path';
import {Base} from 'yeoman-generator';
import * as logging from 'plylog';

let logger = logging.getLogger('cli.init');

export interface GithubGeneratorOptions {
  requestApi?;
  githubApi?;
  githubToken?;
  owner: string;
  repo: string;
}

export function createGithubGenerator(githubOptions: GithubGeneratorOptions) {
  let requestApi = githubOptions.requestApi;
  let githubApi = githubOptions.githubApi;
  let githubToken = githubOptions.githubToken;
  let owner = githubOptions.owner;
  let repo = githubOptions.repo;
开发者ID:LostInBrittany,项目名称:polymer-cli,代码行数:31,代码来源:github.ts

示例4: require

 * http://polymer.github.io/PATENTS.txt
 */

import * as chalk from 'chalk';
import * as fs from 'fs';
import * as logging from 'plylog';

import findup = require('findup-sync');
import * as YeomanEnvironment from 'yeoman-environment';
import {createApplicationGenerator} from '../init/application/application';
import {createElementGenerator} from '../init/element/element';
import {createGithubGenerator} from '../init/github';
import Generator = require('yeoman-generator');
import {prompt} from '../util';

const logger = logging.getLogger('init');

interface GeneratorDescription {
  name: string;
  value: string;
  short: string;
}

interface GeneratorInfo {
  id: string;
  description: string;
  generator: typeof Generator;
}

const localGenerators: {[name: string]: GeneratorInfo} = {
  'polymer-2-element': {
开发者ID:abdonrd,项目名称:polymer-cli,代码行数:31,代码来源:init.ts

示例5: require

 * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
 */

import {Transform} from 'stream';
import * as uglify from 'uglify-js';
import * as logging from 'plylog';
import File = require('vinyl');

import {FileCB} from './streams';

let logger = logging.getLogger('cli.build.uglify');
const UglifyOptions: uglify.MinifyOptions = { fromString: true };

export class UglifyTransform extends Transform {

  constructor() {
    super({objectMode: true});
  }

  _transform(file: File, encoding: string, callback: FileCB): void {
    if (file.contents && file.path.endsWith('.js')) {
      try {
        let contents = file.contents.toString();
        contents = uglify.minify(contents, UglifyOptions).code;
        file.contents = new Buffer(contents);
      } catch (err) {
开发者ID:chuckh,项目名称:polymer-build,代码行数:31,代码来源:uglify-transform.ts

示例6: getPrecachedAssets

 * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
 */

import {writeFile} from 'fs';
import * as path from 'path';
import * as logging from 'plylog';
import {PolymerProject} from './polymer-project';
import {DepsIndex} from './analyzer';
import {SWConfig, generate as swPrecacheGenerate} from 'sw-precache';

let logger = logging.getLogger('polymer-build.service-worker');

export interface AddServiceWorkerOptions {
  project: PolymerProject;
  buildRoot: string;
  bundled?: boolean;
  serviceWorkerPath?: string;
  swConfig?: SWConfig;
}

/**
 * Returns an array of file paths for the service worker to precache, based on
 * the information provided in the DepsIndex object.
 */
function getPrecachedAssets(depsIndex: DepsIndex, project: PolymerProject): string[] {
  let precachedAssets = new Set<string>(project.analyzer.allFragments);
开发者ID:chuckh,项目名称:polymer-build,代码行数:31,代码来源:service-worker.ts

示例7: require

 * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
 */

import * as dom5 from 'dom5';
import * as path from 'path';
import * as logging from 'plylog';
import {Transform} from 'stream';
import File = require('vinyl');
import {StreamAnalyzer, DepsIndex} from 'polymer-build';

let logger = logging.getLogger('cli.build.prefech');

export class PrefetchTransform extends Transform {
  root: string;
  entrypoint: string;
  shell: string;
  fragments: string[];
  allFragments: string[];
  fileMap: Map<string, File>;
  analyzer: StreamAnalyzer;

  constructor(
    /**
     * Root of the dependencies.
     * Will be stripped when making links
     */
开发者ID:NorthernLogic,项目名称:polymer-cli,代码行数:31,代码来源:prefetch.ts

示例8: require

 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */

import * as bower from 'bower';
import {read as readBowerJson} from 'bower-json';
import * as child_process from 'child_process';
import * as path from 'path';
import * as logging from 'plylog';

import defaultBowerConfig = require('bower/lib/config');
import BowerLogger = require('bower-logger');
import StandardRenderer = require('bower/lib/renderers/StandardRenderer');
import BowerProject = require('bower/lib/core/Project');

const logger = logging.getLogger('cli.install');

async function exec(command: string, opts: child_process.ExecOptions) {
  return new Promise<[string, string]>((resolve, reject) => {
    child_process.exec(command, opts, (err, stdout, stderr) => {
      err ? reject(err) : resolve([stdout, stderr]);
    });
  });
}

type JsonValue = string|number|boolean|null|JsonObject|JsonArray;

interface JsonObject {
  [key: string]: JsonValue;
}
开发者ID:Polymer,项目名称:tools,代码行数:30,代码来源:install.ts

示例9: parsePreCacheConfig

/**
 * @license
 * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
 */


import * as fs from 'fs';
import * as logging from 'plylog';
import {SWConfig} from 'polymer-build';

let logger = logging.getLogger('cli.build.sw-precache');

export function parsePreCacheConfig(configFile: string): Promise<SWConfig> {
  return new Promise<SWConfig>((resolve, reject) => {
    fs.stat(configFile, (err) => {
      let config: SWConfig;
      // only log if the config file exists at all
      if (!err) {
        try {
          config = require(configFile);
        } catch (e) {
          logger.warn(`${configFile} file was found but could not be loaded`, {err});
        }
      }
      resolve(config);
    });
开发者ID:akc42,项目名称:polymer-cli,代码行数:31,代码来源:sw-precache.ts

示例10: require

import {JsCompileTarget, ModuleResolutionStrategy} from 'polymer-project-config';
import {Transform} from 'stream';
import * as vinyl from 'vinyl';

import matcher = require('matcher');

import {jsTransform} from './js-transform';
import {htmlTransform} from './html-transform';
import {isHtmlSplitterFile} from './html-splitter';

// TODO(fks) 09-22-2016: Latest npm type declaration resolves to a non-module
// entity. Upgrade to proper JS import once compatible .d.ts file is released,
// or consider writing a custom declaration in the `custom_typings/` folder.
import File = require('vinyl');

const logger = logging.getLogger('cli.build.optimize-streams');

export type FileCB = (error?: Error, file?: File) => void;
export type CSSOptimizeOptions = {
  stripWhitespace?: boolean;
};
export interface OptimizeOptions {
  html?: {
    minify?: boolean|{exclude?: string[]},
  };
  css?: {
    minify?: boolean|{exclude?: string[]},
  };
  js?: JsOptimizeOptions;
  entrypointPath?: string;
  rootDir?: string;
开发者ID:MehdiRaash,项目名称:tools,代码行数:31,代码来源:optimize-streams.ts


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