widelogger 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
File without changes
@@ -0,0 +1,2 @@
1
+ import type { Context } from "./types";
2
+ export declare const flush: (context: Context | undefined) => Record<string, unknown>;
@@ -0,0 +1,35 @@
1
+ import type { DottedKey, FieldValue } from "./types";
2
+ export interface WideloggerOptions {
3
+ service: string;
4
+ defaultEventName: string;
5
+ version?: string;
6
+ commitHash?: string;
7
+ instanceId?: string;
8
+ environment?: string;
9
+ level?: string;
10
+ }
11
+ export interface ErrorFieldsOptions {
12
+ prefix?: string;
13
+ includeStack?: boolean;
14
+ }
15
+ export declare const widelogger: (options: WideloggerOptions) => {
16
+ widelog: {
17
+ set: <K extends string>(key: DottedKey<K>, value: FieldValue) => void;
18
+ count: <K extends string>(key: DottedKey<K>, amount?: number) => void;
19
+ append: <K extends string>(key: DottedKey<K>, value: FieldValue) => void;
20
+ max: <K extends string>(key: DottedKey<K>, value: number) => void;
21
+ min: <K extends string>(key: DottedKey<K>, value: number) => void;
22
+ time: {
23
+ start: <K extends string>(key: DottedKey<K>) => void;
24
+ stop: <K extends string>(key: DottedKey<K>) => void;
25
+ };
26
+ errorFields: (error: unknown, options?: ErrorFieldsOptions) => void;
27
+ flush: () => void;
28
+ context: {
29
+ <T>(callback: () => Promise<T>): Promise<T>;
30
+ <T>(callback: () => T): T;
31
+ };
32
+ };
33
+ destroy: () => Promise<void>;
34
+ };
35
+ export type Widelog = ReturnType<typeof widelogger>["widelog"];