本文整理汇总了TypeScript中loglevel.getLogger函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getLogger函数的具体用法?TypeScript getLogger怎么用?TypeScript getLogger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getLogger函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: afterEach
import * as fs from 'fs';
import * as loglevel from 'loglevel';
import * as os from 'os';
import * as path from 'path';
import * as rimraf from 'rimraf';
import {clean} from './clean';
import {convertArgs2AllOptions} from './utils';
const log = loglevel.getLogger('webdriver-manager-test');
log.setLevel('debug');
describe('using the cli', () => {
const tmpDir = path.resolve(os.tmpdir(), 'test');
afterEach(() => {
try {
rimraf.sync(tmpDir);
} catch (err) {
}
});
describe('a user runs clean', () => {
it('should not log or throw errors if no folder exists', () => {
const argv = {
_: ['foobar'],
out_dir: tmpDir,
'$0': 'bin\\webdriver-manager'
};
const options = convertArgs2AllOptions(argv);
const statusLog = clean(options);
expect(statusLog).toBe('');
示例3: 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);
});
示例4:
// Exports when using this module as a dependency.
// Expose the loglevel api.
import * as loglevel from 'loglevel';
export let setLogLevel = loglevel.getLogger('webdriver-manager').setLevel;
// Export commands used in the cli.
export {clean} from './cmds/clean';
// Options that are used by the exported commands.
export {Options} from './cmds/options';
export {shutdown} from './cmds/shutdown';
export {start} from './cmds/start';
export {status} from './cmds/status';
export {update} from './cmds/update';
export {ChromeDriver} from './provider/chromedriver';
export {GeckoDriver} from './provider/geckodriver';
export {IEDriver} from './provider/iedriver';
export {ProviderConfig, ProviderInterface} from './provider/provider';
export {SeleniumServer} from './provider/selenium_server';
示例5: startServerFromDotEnsimeCP
import * as Promise from 'bluebird'
import {ChildProcess} from 'child_process'
import * as fs from 'fs'
import * as _ from 'lodash'
import * as loglevel from 'loglevel'
import * as path from 'path'
import {DotEnsime} from '../types'
import {startServerFromClasspath} from './server-startup-utils'
const log = loglevel.getLogger('ensime.startup')
// Start ensime server from given classpath file
export function startServerFromDotEnsimeCP(
dotEnsime: DotEnsime,
ensimeServerFlags = ''
): PromiseLike<ChildProcess> {
log.info('Starting server from classpath')
return startServerFromClasspath(dotEnsime.serverJars.concat(dotEnsime.compilerJars), dotEnsime, ensimeServerFlags)
}
export function startServerFromAssemblyJar(
assemblyJar: string,
dotEnsime: DotEnsime,
ensimeServerFlags = ''): PromiseLike<ChildProcess> {
const cp = [assemblyJar].concat(dotEnsime.compilerJars)
log.info('Starting server from assembly jar')
return startServerFromClasspath(cp, dotEnsime, ensimeServerFlags)
}
示例6: createConnection
import * as net from 'net';
import * as path from 'path';
import * as loglevel from 'loglevel';
const log = loglevel.getLogger('ensime.client')
import * as Promise from 'bluebird'
import {WebsocketClient} from '../network/NetworkClient'
import {Typehinted} from '../server-api/server-protocol'
/**
* A running and connected ensime client
*
* low-level api
*/
export interface ServerConnection {
destroy: () => void
httpPort: string
/**
* Post a msg object
*/
post: (msg: any) => PromiseLike<Typehinted>
}
export function createConnection(httpPort: string, generalMsgHandler, serverVersion, serverPid = undefined): PromiseLike<ServerConnection> {
const deferredConnection = Promise.defer<ServerConnection>();
const callbackMap : {[callId: string]: Promise.Resolver<any>} = { }
let ensimeMessageCounter = 1
function handleIncoming(msg) {
示例7: SeleniumServer
import * as http from 'http';
import * as loglevel from 'loglevel';
import * as os from 'os';
import * as path from 'path';
import * as rimraf from 'rimraf';
import {findPort} from '../../spec/support/helpers/port_finder';
import {ChromeDriver} from '../provider/chromedriver';
import {SeleniumServer} from '../provider/selenium_server';
import {OptionsBinary} from './options_binary';
import {shutdownBinary} from './shutdown';
import {startBinary} from './start';
import {updateBinary} from './update';
const log = loglevel.getLogger('webdriver-manager-test');
log.setLevel('debug');
loglevel.getLogger('webdriver-manager').setLevel('info');
const tmpDir = path.resolve(os.tmpdir(), 'test');
const selenium =
new SeleniumServer({outDir: tmpDir, runAsDetach: true, runAsNode: true});
const optionsBinary: OptionsBinary = {
outDir: tmpDir,
browserDrivers: [{binary: new ChromeDriver({outDir: tmpDir})}],
server: {binary: selenium, runAsDetach: true, runAsNode: true}
};
let port: number;
describe('start and stop cmd', () => {
const origTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
示例8: getLogger
.catch(reason => {
getLogger('socko').error(reason.message)
})
示例9: new
public static new(title: string): loglevel.Logger {
return loglevel.getLogger(title);
}
示例10: 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' }))
})