func New(module string, dataFolderPath string, logFileName string) Log {
	var cores []zapcore.Core
	consoleSyncer := zapcore.AddSync(os.Stdout)
	enc := encoder()
	cores = append(cores, zapcore.NewCore(enc, consoleSyncer, logLevel()))
	if dataFolderPath != "" && logFileName != "" {
		wr := getFileWriter(dataFolderPath, logFileName)
		fs := zapcore.AddSync(wr)
		cores = append(cores, zapcore.NewCore(enc, fs, debugLevel))
	}
	core := zapcore.NewTee(cores...)
	log := zap.New(core)
	log = log.Named(module)
	lvl := zap.NewAtomicLevelAt(Level())
	return Log{log, log.Sugar(), &lvl}
}
New creates a logger for a module. e.g. p2p instance logger.
package log
import (
	"io"
	"os"
	"path/filepath"
	"go.uber.org/zap/zapcore"
	"gopkg.in/natefinch/lumberjack.v2"
	"go.uber.org/zap"
)
const mainLoggerName = "00000.defaultLogger"
var debugMode = false
var jsonLog = false
var debugLevel = zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {
	return lvl >= zapcore.DebugLevel
})
var infoLevel = zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {
	return lvl >= zapcore.InfoLevel
})
func logLevel() zap.LevelEnablerFunc {
	if debugMode {
		return debugLevel
	}
	return infoLevel
}
func Level() zapcore.Level {
	if debugMode {
		return zapcore.DebugLevel
	}
	return zapcore.InfoLevel
}
type Logger interface {
	Info(format string, args ...interface{})
	Debug(format string, args ...interface{})
	Error(format string, args ...interface{})
	Warning(format string, args ...interface{})
	WithName(prefix string) Log
}
func encoder() zapcore.Encoder {
	if jsonLog {
		return zapcore.NewJSONEncoder(zap.NewDevelopmentEncoderConfig())
	}
	return zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig())
}
var AppLog Log
func init() {
	AppLog = NewDefault(mainLoggerName)
}
func DebugMode(mode bool) {
	debugMode = mode
}
func JSONLog(b bool) {
	jsonLog = b
}