Skip to main content

Basic Example

Create instance of the logger

const appLogger = logger({
transport: http('https://int.api.ellielabs.com/diagnostics/v2/logging'),
index: 'myapp',
team: 'my team',
appName: 'Hello World App',
});

log messages with different log level

appLogger.info('My application log message');

Logging Exceptions

  try {
...
} catch(ex) {
const logRecord = {
code: 'puiweb002',
message: 'Unable to send message',
exception: ex as Error,
};
appLogger.error(logRecord);
}

Changing default log level

  import { LogLevel } from '@elleimae/pui-diagnostics';
...
appLogger.setLogLevel(LogLevels.DEBUG);