import {MoriaApi} from './MoriaApi'; import { Rivendell } from './Rivendell'; export namespace Moria { export interface LogEntryContext { appId?: string; appVersion?: string; trackerId?: string; installId?: string; entryPoint?: string; requestId?: string; jobId?: string; buildId?: string; } export interface LoggingSearchCriteria { context: LogEntryContext; start?: number; end?: number; audience?: Audience; level?: LogLevel; pageSize?: number; cursor?: string; terms?: string[]; } export interface LoggingSearchResult { cursor: string; entries: LogEntry[]; } export interface LogEntry { id: string; level: LogLevel; time: number; message: string; context: LogEntryContext; audience: Audience; } export enum Audience { USER = 'USER', DEVELOPER = 'DEVELOPER', ZAIUS = 'ZAIUS' } export enum LogLevel { INFO = 'INFO', DEBUG = 'DEBUG', WARN = 'WARN', ERROR = 'ERROR' } /** * Search for LogEntries using the supplied criteria. * @param criteria */ export async function searchLogging( criteria: LoggingSearchCriteria, shard: Rivendell.Shard ): Promise { const response = await MoriaApi.post(shard, 'logging/search', criteria); return response.body; } }