本文整理匯總了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');
});
示例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');
});
示例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;
示例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': {
示例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) {
示例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);
示例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
*/
示例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;
}
示例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);
});
示例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;