export interface GenerateLogConf { outputDirPath: string; inputDirPath: string; } function getConfTemplate(inputDir: string, outputDir: string) { return `module.exports = { // 源文件目录(绝对路径),写在files里的文件会从此目录查找 inputDirPath: '${inputDir}', // 输出文件目录(绝对路径),文件处理完成后将输出到此目录 outputDirPath: '${outputDir}', // 要处理的文件名数组 // 例:files: ['aa.log', 'bb.log'] files: [], options: { // 日志文件中,要解析的key,写在keys这个数组里面 // 如示例中的日志数据,想取出 logId、url 和日志时间写法如下 // 例: keys: ['logId', 'url', 'create_time'] // create_time 为固定写法,代表日志时间 keys: [], // 日志文件中KV的分隔符,可不写,不写默认是 = 号 kvSeparator: '=' }, }`; } export function generateLogConf(conf: GenerateLogConf): Promise { return Promise.resolve(getConfTemplate(conf.inputDirPath, conf.outputDirPath)); }