Add logging stubs
This commit is contained in:
44
deno/logging.ts
Normal file
44
deno/logging.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
// internal-logging.ts
|
||||
|
||||
// FIXME: Move this to somewhere more appropriate
|
||||
type AtLeastOne<T> = [T, ...T[]];
|
||||
|
||||
type MessageSource = "logging" | "diagnostic" | "user";
|
||||
|
||||
type Message = {
|
||||
// FIXME: number probably isn't what we want here
|
||||
timestamp: number;
|
||||
source: MessageSource;
|
||||
|
||||
text: AtLeastOne<string>;
|
||||
};
|
||||
|
||||
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 };
|
||||
Reference in New Issue
Block a user