本文整理匯總了TypeScript中loglevel.setLevel函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript setLevel函數的具體用法?TypeScript setLevel怎麽用?TypeScript setLevel使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了setLevel函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: return
return (options) => {
// handle global options
setLevel(levels[options.parent.logLevel.toUpperCase()]);
// handle specific action
info(`run ${cyan(options.name())}...`);
return action(options)
.then(() => info(`finished ${cyan(options.name())} âĽ`))
.catch(handleError);
};
示例2: async
return async (options: any) => {
// handle global options
setLevel(levels[options.parent.logLevel.toUpperCase()]);
// handle specific action
try {
// update notifier runs parallel to action (if it's not ignored)
const ignoreUpdates =
options.parent.ignoreUpdate || project.ws.ignoreUpdates;
const handleUpdateNotifier = ignoreUpdates
? undefined
: initializeUpdateNotifier(pkg.version);
info(`run ${cyan(options.name())}...`);
const actionModule = await importAction();
await actionModule.default(options);
info(`finished ${cyan(options.name())} âĽ`);
if (handleUpdateNotifier) {
handleUpdateNotifier();
}
} catch (err) {
handleError(err);
}
};
示例3: require
export const log = require('loglevel')
if(process.env.NODE_ENV == 'development') {
log.setLevel('debug')
}
export function logTrace(msg: string, ...otherArgs: any[]) {
return log.trace(msg, ...otherArgs)
}
export function logDebug(msg: string, ...otherArgs: any[]) {
return log.debug(msg, ...otherArgs)
}
export function logInfo(msg: string, ...otherArgs: any[]) {
return log.info(msg, ...otherArgs)
}
export function logWarn(msg: string, ...otherArgs: any[]) {
return log.warn(`Warning: ${msg}`, ...otherArgs)
}
export function logError(msg: string, ...otherArgs: any[]) {
return log.error(`Error: ${msg}`, ...otherArgs)
}
示例4:
import * as log from 'loglevel';
if (process.env.NODE_ENV === 'development') {
log.setLevel('debug');
} else {
log.setLevel('info');
}
export default log;
示例5: waitsFor
import * as chokidar from 'chokidar'
import * as fs from 'fs'
import * as loglevel from 'loglevel'
import * as path from 'path'
import * as temp from 'temp'
loglevel.setDefaultLevel(LogLevel.TRACE)
loglevel.setLevel('trace')
const log = loglevel.getLogger('ensime-cloent-startup-spec')
const testFile = expectedFile => {
const spy = jasmine.createSpy('callback')
const watcher = chokidar.watch(expectedFile, {
persistent: true
}).on('add', path => {
spy()
return watcher.close()
})
fs.writeFileSync(expectedFile, 'Hello Gaze, see me!')
return waitsFor(() => spy.calls.count() > 0, "callback wasn't called in time", 5000)
}
xdescribe('chokidar', () => {
it('should notice absolute paths, even from temp', () => {
testFile(temp.track().path({ suffix: '.txt' }))
})
示例6: require
PlatformTools.setTargetPlatform(TargetPlatformId.TWBS_WEB);
run = require("../imports/for-real-cards/top-frame/top-frame.twbs.ts").run;
}
}
import { enableProdMode } from '@angular/core';
import { prepare as prepareWeb } from "../imports/for-real-cards/top-frame/top-frame.twbs";
//import { prepare as prepareMobile } from "../imports/for-real-cards/top-frame/top-frame.ionic";
console.log("In apps.ts @" + new Date());
console.log(Meteor.absoluteUrl());
if (Meteor.isProduction) {
console.log("Production environment detected. Log level set to error");
log.setLevel(LogLevel.ERROR);
enableProdMode();
} else {
console.log("Development environment detected. Log level set to info");
log.setLevel(LogLevel.TRACE);
}
if (Meteor.isCordova) {
// prepareMobile();
prepareWeb();
document.addEventListener('deviceready', () => {
//ionicSelector('for-real-cards-top-frame');
run();
// setClass('mobile');
});
} else {
示例7:
import * as log from 'loglevel';
import "/imports/for-real-cards-meteor";
import '../imports/common-app-meteor/user.model';
declare var BrowserPolicy;
log.setLevel(0, true)
Meteor.startup(function() {
console.log('Configuring content-security-policy');
BrowserPolicy.content.allowSameOriginForAll();
BrowserPolicy.content.allowOriginForAll('http://192.168.0.92');
BrowserPolicy.content.allowOriginForAll('http://fonts.googleapis.com');
BrowserPolicy.content.allowOriginForAll('http://fonts.gstatic.com');
BrowserPolicy.content.allowOriginForAll('https://maxcdn.bootstrapcdn.com');
BrowserPolicy.content.allowOriginForAll('https://for-real-cards.scalingo.io');
BrowserPolicy.content.allowOriginForAll('https://for-real-cards.fabrica.tech');
BrowserPolicy.content.allowOriginForAll('http://for-real-cards.scalingo.io');
BrowserPolicy.content.allowOriginForAll('http://for-real-cards.fabrica.tech');
BrowserPolicy.content.allowOriginForAll('https://www.googletagmanager.com');
BrowserPolicy.content.allowOriginForAll('http://www.google-analytics.com');
BrowserPolicy.content.allowOriginForAll('https://*.firebaseio.com');
BrowserPolicy.content.allowOriginForAll('https://firebasestorage.googleapis.com');
BrowserPolicy.content.allowEval();
BrowserPolicy.framing.disallow();
});
示例8:
import * as moduleLog from 'loglevel';
moduleLog.trace('Trace message');
moduleLog.debug('Debug message');
moduleLog.info('Info message');
moduleLog.warn('Warn message');
moduleLog.error('Error message');
moduleLog.debug(['Hello', 'world', 42]);
moduleLog.setLevel(0);
moduleLog.setLevel(0, false);
moduleLog.setLevel('error');
moduleLog.setLevel('ERROR');
moduleLog.setLevel('error', false);
moduleLog.setLevel('ERROR', false);
moduleLog.setLevel(moduleLog.levels.WARN);
moduleLog.setLevel(moduleLog.levels.WARN, false);
moduleLog.enableAll(false);
moduleLog.enableAll();
moduleLog.disableAll(true);
moduleLog.disableAll();
const logLevel = moduleLog.getLevel();
const testLogger: moduleLog.Logger = moduleLog.getLogger('TestLogger');
testLogger.setLevel(logLevel);
testLogger.warn('logging test');