var winston=require("winston");var moment=require("moment");var fs=require("fs");var schedule=require("node-schedule");module.exports=exports=Logger;function Logger(c){var b=((c.level!==undefined)&&(c.level>=0&&c.level<=7))?c.level:4,i,g=c.timestamp||"YYYY-MM-DD HH:mm:ss",h=c.maxFiles||100;if(c.dir){i=c.dir;try{fs.accessSync(i)}catch(f){if(f.code==="ENOENT"){fs.mkdirSync(i)}}}else{fs.mkdirSync("./logs");i="./logs"}var j=new (winston.Logger)({levels:winston.config.syslog.levels,transports:[new (winston.transports.File)({name:"logger",filename:"share_server."+moment().format("YYYYMMDD")+".log",dirname:i,json:false,timestamp:function(){return moment().format(g)},})]});var a=schedule.scheduleJob("0 1 25 * *",function(){fs.readdir(i,function(e,l){if(e){throw new Error(e)}if(l.length>h){var n=l.length-h,m=l.sort(function(p,o){return po?1:0)});for(var k=0;k";if(k&&typeof k==="function"){j.log(l,e,k)}else{j.log(l,e)}}}};