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


TypeScript loglevel.setLevel函數代碼示例

本文整理匯總了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);
 };
開發者ID:Mercateo,項目名稱:typedocs,代碼行數:9,代碼來源:index.ts

示例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);
    }
  };
開發者ID:otbe,項目名稱:ws,代碼行數:24,代碼來源:index.ts

示例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)
}
開發者ID:sigmacloud,項目名稱:rest-resource-vue-tools,代碼行數:25,代碼來源:index.ts

示例4:

import * as log from 'loglevel';

if (process.env.NODE_ENV === 'development') {
    log.setLevel('debug');
} else {
    log.setLevel('info');
}

export default log;
開發者ID:rhysd,項目名稱:Tui,代碼行數:9,代碼來源:log.ts

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

示例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 {
開發者ID:kokokenada,項目名稱:for-real-cards,代碼行數:31,代碼來源:app.ts

示例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();
});
開發者ID:kokokenada,項目名稱:for-real-cards,代碼行數:27,代碼來源:main.ts

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


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