本文整理匯總了TypeScript中loglevel.setDefaultLevel函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript setDefaultLevel函數的具體用法?TypeScript setDefaultLevel怎麽用?TypeScript setDefaultLevel使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了setDefaultLevel函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getLogger
public getLogger (): log.Logger {
let prefix = require('loglevel-plugin-prefix')
prefix.apply(
log,
{
template: '[%t] %l (%n)'
}
)
log.setDefaultLevel(this.loglevel as log.LogLevelDesc)
let logger = log.getLogger('socko')
return logger
}
示例2: require
require('source-map-support').install();
import * as loglevel from 'loglevel';
import {AbcApiConfig} from './AbcApiConfig';
import {ApiServer} from './server/ApiServer';
import {getDaoMap} from './lib/database/IDaoMap';
import {getServices} from './lib/IServiceMap';
import {getControllers} from './server/IControllerMap';
loglevel.setDefaultLevel('info');
const logger = loglevel.getLogger('api-main.ts');
logger.info('Starting Abc-Map API ...');
const main = async function(): Promise<any> {
const daoMap = getDaoMap();
const serviceMap = await getServices(daoMap);
const controllerMap = getControllers(serviceMap);
const config = new AbcApiConfig();
const httpServer = new ApiServer(config, controllerMap);
httpServer.start();
};
main().catch(error => {
logger.error(error);
process.exit(1);
});
示例3: 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' }))
})
示例4: enableProdMode
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import log from 'loglevel';
if (environment.production) {
enableProdMode();
}
log.setDefaultLevel(log.levels.INFO);
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
示例5:
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.setDefaultLevel(0);
moduleLog.setDefaultLevel('error');
moduleLog.setDefaultLevel('ERROR');
moduleLog.setDefaultLevel(moduleLog.levels.WARN);
moduleLog.enableAll(false);
moduleLog.enableAll();
moduleLog.disableAll(true);
moduleLog.disableAll();
const logLevel = moduleLog.getLevel();
const testLogger: moduleLog.Logger = moduleLog.getLogger('TestLogger');
testLogger.setDefaultLevel(logLevel);
testLogger.setLevel(logLevel);