Create a simple logger with debug
, warn
, info
and error
functions
to easily post log entries.
Example usage
import { Client } from '@actyx/os-sdk'
const ActyxOS = Client()
const logger: SimpleLogger = ActyxOS.consoleService.SimpleLogger({
logName: 'myLogger',
producerName: 'com.example.app1',
producerVersion: '1.0.0'
})
logger.debug('this is a DEBUG message')
logger.warn('this is a WARNING message')
logger.info('this is an INFO message')
logger.error('this is an ERROR message')
logger.debug('This is a message with additional data', {foo: 'bar'})
Please refer to SimpleLoggerOpts for more details about how to configure this simple logger.
This function allows you to log to the ActyxOS Console Service. You can pass in either a LogEntryDraft object or a LogOpts object. You must use the LogOpts object if you want to provide callback for when the log entry has been successfully posted or if an error occurs.
Example usage
import { Client } from '@actyx/os-sdk'
const ActyxOS = Client()
ActyxOS.consoleService.log({
entry: {
logName: 'myCustomLogger',
message: 'this is a WARNING message',
severity: LogSeverity.WARN,
producer: {
name: 'com.example.app1',
version: '1.0.0'
},
additionalData: {
foo: 'bar',
bar: {
foo: true,
}
},
labels: {
'com.example.app1.auth.username': 'john.doe',
'com.example.app1.model.events': '10000',
}
},
// Callback on successful logging
onLogged: () => {
// Do something
},
// Callback on error logging
onError: err => {
console.error(`error logging: ${err}`)
}
})
This function allows you to log a LogEntryDraft to the ActyxOS Console Service.
Example usage
import { Client } from '@actyx/os-sdk'
const ActyxOS = Client()
await ActyxOS.consoleService.logPromise({
logName: 'myCustomLogger',
message: 'this is a WARNING message',
severity: LogSeverity.WARN,
producer: {
name: 'com.example.app1',
version: '1.0.0'
},
additionalData: {
foo: 'bar',
bar: {
foo: true,
}
},
labels: {
'com.example.app1.auth.username': 'john.doe',
'com.example.app1.model.events': '10000',
}
})
Generated using TypeDoc
This interface specifies the functionality that this SDK offers for interacting with the ActyxOS Console Service.