···1515import pinoRoll from 'pino-roll';
1616import prettyDef, {PrettyOptions} from 'pino-pretty';
1717import {createColors} from 'colorette';
1818-import * as Colorette from "colorette";
1918import {fileOrDirectoryIsWriteable} from "./util.js";
20192120const projectDir = process.cwd();
+6-6
src/types.ts
···22import {ErrorWithCause} from "pony-cause";
3344export type AdditionalLevels = "verbose" | "log";
55-export type AllLevels = Level | AdditionalLevels;
66-export type LogLevel = AllLevels;
77-export const logLevels: LogLevel[] = ['fatal', 'error', 'warn', 'info', 'verbose', 'debug'];
55+export type AllLevels = typeof LOGLEVELS[number];
66+export type LogLevel = AllLevels
77+export const LOGLEVELS= ['fatal', 'error', 'warn', 'info', 'log', 'verbose', 'debug'] as (Level | AdditionalLevels)[];
8899export interface LogOptions {
1010 /**
···3232 return false;
3333 }
3434 if (key !== 'file') {
3535- return val === undefined || logLevels.includes(val.toLocaleLowerCase());
3535+ return val === undefined || LOGLEVELS.includes(val.toLocaleLowerCase());
3636 }
3737- return val === undefined || val === false || logLevels.includes(val.toLocaleLowerCase());
3737+ return val === undefined || val === false || LOGLEVELS.includes(val.toLocaleLowerCase());
3838 });
3939}
40404141-export type LabelledLogger = Logger<AllLevels> & {
4141+export type LabelledLogger = Logger<LogLevel> & {
4242 labels: any[]
4343 addLabel: (value: any) => void
4444}
+2-2
tests/index.test.ts
···55import chai, {expect} from "chai";
66import {pEvent} from 'p-event';
77import {sleep} from "../src/util.js";
88-import {LogData, logLevels} from "../src/types.js";
88+import {LogData, LOGLEVELS} from "../src/types.js";
99import withLocalTmpDir from 'with-local-tmp-dir';
1010import {readdirSync,} from 'node:fs';
1111···4949 })
50505151 it('does not throw when a valid level is given', function () {
5252- for (const level of logLevels) {
5252+ for (const level of LOGLEVELS) {
5353 expect(() => buildParsedLogOptions({level})).to.not.throw;
5454 }
5555 })