1.0.1 • Published 2 years ago

lazy-kit-logger v1.0.1

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

lazy-kit-logger

A customized log4js toolkit, and defined a new FootPrint class used to print conetent to a specified file.

Functions

/**
 * 业务参数
 */
interface LogOpts {
  mode?: "dev"|"test"|"prd"; // 日志的输出环境
  path?: string; // 日志存储的路径
  file?: string; // 是否指定文件名
  file_type?: "file"|"dateFile";
  file_pattern?: string; // 格式文件名, 仅dateFile时设置
  file_maxsize?: number; // 文大小限制
  file_backups?: number; // 文大小限制之后最多保存的文件个数
  layout_type?: "basic"|"json"|"pattern";
  layout_pattern?: string;
}
/**
 * 创建log4js实例
 * 创建的实例的配置是全局的, 也就是说, 多个create之后的logger实例是最后一次创建的实例
 * @param options 
 * @returns 
 */
function create(options?:LogOpts): Logger;
/**
 * 将Tag拥有的专属信息打印到专门的日志文件
 */
interface FPOpts {
  path?:string; // 文件存储路径, 默认process.cwd()
  layout?:"plain"|"json"; // 输出格式, 默认"plain"
  ext?:string; // 扩展名, 默认".fp"
}
/**
 * 跟踪一个文件持续打印
 */
class FootPrint {
  constructor(options?:FPOpts);
  /**
   * 打印到指定标签tag对应的文件
   */
  print(tag:string, ...args:any): void;
}
1.0.1

2 years ago

1.0.0

2 years ago