@onesy/log
Version:
Log utils, very readable and clean logs
95 lines (94 loc) • 2.9 kB
TypeScript
import OnesySubscription from '@onesy/subscription';
import { TMethod } from '@onesy/models';
export declare type TVariant = 'log' | 'debug' | 'info' | 'warn' | 'error' | 'important';
export declare const variantNames: Array<TVariant>;
export interface IOnesyLogVariantColor {
browser: string;
server: string;
}
export interface IOnesyLogVariantPre {
subscription: OnesySubscription;
}
export interface IOnesyLogVariantPost {
subscription: OnesySubscription;
}
export interface IOnesyLogVariant {
name: 'log' | TVariant;
prefix?: any;
sufix?: any;
color?: IOnesyLogVariantColor;
pre?: IOnesyLogVariantPre;
post?: IOnesyLogVariantPost;
}
export declare type IOnesyLogVariants = {
[p in TVariant]?: IOnesyLogVariant;
};
export interface IOnesyLogOptionsLogPadding {
top?: boolean;
bottom?: boolean;
}
export interface IOnesyLogOptionsLog {
archive?: boolean;
enabled?: boolean;
native?: boolean;
variants?: Array<TVariant>;
padding?: IOnesyLogOptionsLogPadding;
}
export interface IOnesyLogOptionsArguments {
pre?: any[];
post?: any[];
}
export interface IOnesyLogOptionsDate {
add?: boolean;
method?: TMethod;
}
export interface IOnesyLogOptionsStringify {
method?: TMethod;
}
export interface IOnesyLogOptions {
minimal?: boolean;
log?: IOnesyLogOptionsLog;
arguments?: IOnesyLogOptionsArguments;
variants?: IOnesyLogVariants;
date?: IOnesyLogOptionsDate;
stringify?: IOnesyLogOptionsStringify;
}
interface ILog {
method?: TMethod;
arguments?: string[];
logged: boolean;
}
export interface IOnesyLog {
variants: IOnesyLogVariants;
options: IOnesyLogOptions;
[property: string]: any;
}
declare class OnesyLog implements IOnesyLog {
options: IOnesyLogOptions;
variants: IOnesyLogVariants;
archive: any[];
static options: IOnesyLogOptions;
static variants: IOnesyLogVariants;
static archive: any[];
static archiveClear(): void;
static get onesylog(): OnesyLog;
static log(variant_?: TVariant, ...args: any[]): ILog;
static debug(...args: any[]): ILog;
static info(...args: any[]): ILog;
static warn(...args: any[]): ILog;
static error(...args: any[]): ILog;
static important(...args: any[]): ILog;
static color(value: any, color?: string, options?: IOnesyLogVariantColor): Array<string>;
static get variantNames(): Array<TVariant>;
static get variantsDefault(): Array<IOnesyLogVariant>;
constructor(options?: IOnesyLogOptions);
log(variant_?: TVariant, ...args: any[]): ILog;
debug(...args: any[]): undefined | ILog;
info(...args: any[]): undefined | ILog;
warn(...args: any[]): undefined | ILog;
error(...args: any[]): undefined | ILog;
important(...args: any[]): undefined | ILog;
archiveClear(): void;
static reset(): void;
}
export default OnesyLog;