1.0.2 • Published 8 months ago

sva-ccsd-otlp-logger-js v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Introduction

This is an opentelemetry vuejs logger for seq.

Development

  • npm i
  • tbd

Usage

  • install this package trough azure devops artifacts
  • get your seq app config with URL and API_KEY
  • choose a NAMESPACE (general projectname e.g. SVAFit@Work) and a SERVICE_NAME (the name of the specific service e.g. UI, Frontend, App, ..)
  • import and use in your main.ts
import { Logger, type LoggerConfig } from 'sva-ccsd-otlp-logger-js';

const loggerConfig: LoggerConfig = {
  URL: 'URL_PLACEHOLDER',
  API_KEY: 'API_KEY_PLACEHOLDER',
  NAMESPACE: 'NAMESPACE_PLACEHOLDER',
  SERVICE_NAME: 'SERVICE_NAME_PLACEHOLDER',
};

app.use(Logger, loggerConfig);

your errors are tracked automatically

Write your own logs

if you need to write your own logs use:

  • logDebug (message: string, attributes?: Record<string, any>): void - development
  • logError (message: string, attributes?: Record<string, any>): void - errors
  • logInfo (message: string, attributes?: Record<string, any>): void - general information
  • logWarn (message: string, attributes?: Record<string, any>): void - warnings

the attributes param can be used to add custom key value pairs to the log message e.g.:

import { logInfo } from 'sva-ccsd-otlp-logger-js';

logInfo('UserService entered', { source: 'MyApp' });

Update and Deploy

To update the npm package do the following:

  • increment the version in the package.json
  • tbd