index.d.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Type definitions for logform 1.2
  2. // Project: https://github.com/winstonjs/logform
  3. // Definitions by: DABH <https://github.com/DABH>
  4. // Definitions: https://github.com/winstonjs/logform
  5. // TypeScript Version: 2.2
  6. export interface TransformableInfo {
  7. level: string;
  8. message: string;
  9. [key: string]: any;
  10. }
  11. export type TransformFunction = (info: TransformableInfo, opts?: any) => TransformableInfo | boolean;
  12. export type Colors = { [key: string]: string | string[] }; // tslint:disable-line interface-over-type-literal
  13. export type FormatWrap = (opts?: any) => Format;
  14. export class Format {
  15. constructor(opts?: object);
  16. options?: object;
  17. transform: TransformFunction;
  18. }
  19. export class Colorizer extends Format {
  20. constructor(opts?: object);
  21. createColorize: (opts?: object) => Colorizer;
  22. addColors: (colors: Colors) => Colors;
  23. colorize: (level: string, message: string) => string;
  24. }
  25. export function format(transform: TransformFunction): FormatWrap;
  26. export function levels(config: object): object;
  27. export namespace format {
  28. function align(opts?: object): Format;
  29. function cli(opts?: object): Format;
  30. function colorize(opts?: object): Colorizer;
  31. function combine(...formats: Format[]): Format;
  32. function json(opts?: object): Format;
  33. function label(opts?: object): Format;
  34. function logstash(opts?: object): Format;
  35. function metadata(opts?: object): Format;
  36. function ms(opts?: object): Format;
  37. function padLevels(opts?: object): Format;
  38. function prettyPrint(opts?: object): Format;
  39. function printf(templateFunction: (info: TransformableInfo) => string): Format;
  40. function simple(opts?: object): Format;
  41. function splat(opts?: object): Format;
  42. function timestamp(opts?: object): Format;
  43. function uncolorize(opts?: object): Format;
  44. }