@here/harp-utils
TypeScript icon, indicating that this package has built-in type declarations

0.28.0 • Public • Published

@here/harp-utils

Overview

This module provides utility classes. Such as, but not limited to:

  • logging
  • caching
  • URL resolving
  • Simple Math

Logger

Custom logger for writing messages to browser console or separate window. Messages could be filtered by log names or completely disabled via URI parameters or UI. Logger name is required and cannot be empty.

import { LoggerManager, LogLevel } from '@here/harp-utils';

const loggerManager = LoggerManager.instance;

// Create named logger and configure it to Warn log level.
const logger: ILogger = loggerManager.create('my logger', {
    level: LogLevel.Warn
});

// Warning 'my logger: something' logged to output.
logger.warn('something...');

// Won't be logged because log level is 'warn'.
logger.log('not logged...');

// Now, message is logged.
logger.level = LogLevel.Log;
logger.log('logged...');

// Be good developer. Free resources after you done.
// Unregister logger from global registry.
loggerManager.dispose(logger);

Dependents (16)

Package Sidebar

Install

npm i @here/harp-utils

Weekly Downloads

63

Version

0.28.0

License

Apache-2.0

Unpacked Size

118 kB

Total Files

68

Last publish

Collaborators

  • here-bot
  • here-maps
  • heremaps