logging-client
TypeScript icon, indicating that this package has built-in type declarations

0.4.8 • Public • Published

Logging Client for Autonomous (support Web, NodeJs, React Native, ElectronJS)

import { LogService } from 'logging-client';

// config
const env = 'dev'; // "dev" | "staging" | "prod"
const serviceName = 'service_name';
const options = { logServerUrl: 'http:...', batchLimit: 3, batchIntervalMs: 2000 };
const Log = new LogService(env, serviceName, options);

// set user agent (optional)
Log.setUserAgent({
  platform: "desktop",
  app_version: "1.0",
  user_info: {
    id: "user-1"
  }
});

// set client fingerprint (optional)
Log.setClientFingerprint("f-123");


// create log with namespace
const moduleALog = Log.createLog('module-A');

moduleALog.debug('debug');
moduleALog.info('info');
moduleALog.warning('warning');
moduleALog.error('error');
moduleALog.critical('critical');
moduleALog.track('track');

Readme

Keywords

none

Package Sidebar

Install

npm i logging-client

Weekly Downloads

64

Version

0.4.8

License

MIT

Unpacked Size

71.2 kB

Total Files

45

Last publish

Collaborators

  • vuong.dao