Admin Service

This service provides a handle to admin related APIs which currently has logging related APIs.

Creation of Admin Service

To create Admin client

Typescript
const adminService: AdminService = await AdminService()

Usages of Admin Service

Type definitions for all Admin Service methods can be found here

Fetching LogMetadata & Setting log level

For instance, we need logging configuration to be known before setting log level of a component if it is not set to desired log level.

Type definitions for getLogMetadata can be found here Type definitions for setLogLevel can be found here

In the given example, we want to set ERROR log level for the component if it’s not already set to ERROR.

Typescript
const prefix = new Prefix('TCS', 'filter.wheel')
const componentId = new ComponentId(prefix, 'HCD')

const logMetaData: LogMetadata = await adminService.getLogMetadata(componentId)

if (logMetaData.componentLevel !== 'ERROR') {
  const actionStatus: Done = await adminService.setLogLevel(
    componentId,
    'ERROR'
  )
}