當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript loglevel.setDefaultLevel函數代碼示例

本文整理匯總了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
 }
開發者ID:dploeger,項目名稱:socko,代碼行數:12,代碼來源:DefaultOptions.ts

示例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);
});
開發者ID:remipassmoilesel,項目名稱:Abcmap,代碼行數:31,代碼來源:api-main.ts

示例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' }))
  })
開發者ID:ensime,項目名稱:ensime-node,代碼行數:30,代碼來源:ensime-client-startup.spec.ts

示例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));
開發者ID:chipster,項目名稱:chipster-web,代碼行數:15,代碼來源:main.ts

示例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);
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:loglevel-tests.ts


注:本文中的loglevel.setDefaultLevel函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。