UNPKG

@prefecthq/prefect-ui-library

Version:

This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.

24 lines (21 loc) 828 B
import { Log, LogLevel, logLevel } from '@/models/Log' import { MockFunction } from '@/services/Mocker' import { random, uniform } from '@/utilities/math' export const randomLogLevel: MockFunction<LogLevel, []> = function() { return logLevel[uniform(0, logLevel.length - 1)] } export const randomLog: MockFunction<Log, [Partial<Log>?]> = function(overrides = {}) { return new Log({ id: this.create('id'), created: this.create('date'), updated: this.create('date'), name: `${this.create('adjective')}.${this.create('noun')}`, level: this.create('logLevel'), message: random() > 0.75 ? this.create('paragraph') : this.create('sentence'), timestamp: this.create('date'), flowRunId: this.create('id'), taskRunId: this.create('id'), workerId: this.create('id'), ...overrides, }) }