// internal-logging.ts // FIXME: Move this to somewhere more appropriate type AtLeastOne = [T, ...T[]]; type MessageSource = "logging" | "diagnostic" | "user"; type Message = { // FIXME: number probably isn't what we want here timestamp?: number; source: MessageSource; text: AtLeastOne; }; const m1: Message = { timestamp: 123, source: "logging", text: ["foo"] }; const m2: Message = { timestamp: 321, source: "diagnostic", text: ["ok", "whatever"], }; type FilterArgument = { limit?: number; before?: number; after?: number; // FIXME: add offsets to use instead of or in addition to before/after match?: (string | RegExp)[]; }; const log = (_message: Message) => { // WRITEME }; const getLogs = (filter: FilterArgument) => { // WRITEME }; // FIXME: there's scope for more specialized functions although they // probably should be defined in terms of the basic ones here. export { getLogs, log };