mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 12:32:13 +08:00
163 lines
2.1 KiB
TypeScript
163 lines
2.1 KiB
TypeScript
import { LogLevel } from '@grafana/data';
|
|
|
|
let index = 0;
|
|
|
|
export function getRandomLogLevel(): LogLevel {
|
|
const v = Math.random();
|
|
if (v > 0.9) {
|
|
return LogLevel.critical;
|
|
}
|
|
if (v > 0.8) {
|
|
return LogLevel.error;
|
|
}
|
|
if (v > 0.7) {
|
|
return LogLevel.warning;
|
|
}
|
|
if (v > 0.4) {
|
|
return LogLevel.info;
|
|
}
|
|
if (v > 0.3) {
|
|
return LogLevel.debug;
|
|
}
|
|
if (v > 0.1) {
|
|
return LogLevel.trace;
|
|
}
|
|
return LogLevel.unknown;
|
|
}
|
|
|
|
export function getNextWord() {
|
|
index = (index + Math.floor(Math.random() * 5)) % words.length;
|
|
return words[index];
|
|
}
|
|
|
|
export function getRandomLine(length = 60) {
|
|
let line = getNextWord();
|
|
while (line.length < length) {
|
|
line += ' ' + getNextWord();
|
|
}
|
|
return line;
|
|
}
|
|
|
|
const words = [
|
|
'At',
|
|
'vero',
|
|
'eos',
|
|
'et',
|
|
'accusamus',
|
|
'et',
|
|
'iusto',
|
|
'odio',
|
|
'dignissimos',
|
|
'ducimus',
|
|
'qui',
|
|
'blanditiis',
|
|
'praesentium',
|
|
'voluptatum',
|
|
'deleniti',
|
|
'atque',
|
|
'corrupti',
|
|
'quos',
|
|
'dolores',
|
|
'et',
|
|
'quas',
|
|
'molestias',
|
|
'excepturi',
|
|
'sint',
|
|
'occaecati',
|
|
'cupiditate',
|
|
'non',
|
|
'provident',
|
|
'similique',
|
|
'sunt',
|
|
'in',
|
|
'culpa',
|
|
'qui',
|
|
'officia',
|
|
'deserunt',
|
|
'mollitia',
|
|
'animi',
|
|
'id',
|
|
'est',
|
|
'laborum',
|
|
'et',
|
|
'dolorum',
|
|
'fuga',
|
|
'Et',
|
|
'harum',
|
|
'quidem',
|
|
'rerum',
|
|
'facilis',
|
|
'est',
|
|
'et',
|
|
'expedita',
|
|
'distinctio',
|
|
'Nam',
|
|
'libero',
|
|
'tempore',
|
|
'cum',
|
|
'soluta',
|
|
'nobis',
|
|
'est',
|
|
'eligendi',
|
|
'optio',
|
|
'cumque',
|
|
'nihil',
|
|
'impedit',
|
|
'quo',
|
|
'minus',
|
|
'id',
|
|
'quod',
|
|
'maxime',
|
|
'placeat',
|
|
'facere',
|
|
'possimus',
|
|
'omnis',
|
|
'voluptas',
|
|
'assumenda',
|
|
'est',
|
|
'omnis',
|
|
'dolor',
|
|
'repellendus',
|
|
'Temporibus',
|
|
'autem',
|
|
'quibusdam',
|
|
'et',
|
|
'aut',
|
|
'officiis',
|
|
'debitis',
|
|
'aut',
|
|
'rerum',
|
|
'necessitatibus',
|
|
'saepe',
|
|
'eveniet',
|
|
'ut',
|
|
'et',
|
|
'voluptates',
|
|
'repudiandae',
|
|
'sint',
|
|
'et',
|
|
'molestiae',
|
|
'non',
|
|
'recusandae',
|
|
'Itaque',
|
|
'earum',
|
|
'rerum',
|
|
'hic',
|
|
'tenetur',
|
|
'a',
|
|
'sapiente',
|
|
'delectus',
|
|
'ut',
|
|
'aut',
|
|
'reiciendis',
|
|
'voluptatibus',
|
|
'maiores',
|
|
'alias',
|
|
'consequatur',
|
|
'aut',
|
|
'perferendis',
|
|
'doloribus',
|
|
'asperiores',
|
|
'repellat',
|
|
];
|