func initLog() { log_level := l4g.INFO log_path := config.LOGGING.PATH syscall.Mkdir(filepath.Dir(log_path), 0755) log = make(l4g.Logger) log.AddFilter("file", log_level, l4g.NewFileLogWriter(log_path, true)) }
func init() { tmplog = make(log4go.Logger) tmplog.AddFilter("stdout", log4go.DEBUG, log4go.NewConsoleLogWriter()) //单位是字节 fw := log4go.NewFileLogWriter("code.log", false).SetRotateSize(10 * 1024 * 1024).SetRotate(true) tmplog.AddFilter("log", log4go.INFO, fw) Log = new(MyLogger) }
func log_init(log l4g.Logger, conf *proxy.ProxyConfig) { log_level := l4g.INFO switch conf.LOGGING.LEVEL { case "debug": log_level = l4g.DEBUG case "info": log_level = l4g.INFO case "warning": log_level = l4g.WARNING case "error": log_level = l4g.ERROR case "critical": log_level = l4g.CRITICAL } log_path := conf.LOGGING.PATH syscall.Mkdir(filepath.Dir(log_path), 0755) log.AddFilter("file", log_level, l4g.NewFileLogWriter(log_path, true)) }
func init() { Config, _ = goconfig.LoadConfigFile("../etc/config.ini") logFilePath, _ := Config.GetValue("lessgo", "logFilePath") tmplog = make(log4go.Logger) tmplog.AddFilter("stdout", log4go.DEBUG, log4go.NewConsoleLogWriter()) //单位是字节 fw := log4go.NewFileLogWriter(logFilePath, false).SetRotateSize(10 * 1024 * 1024).SetRotate(true) tmplog.AddFilter("log", log4go.INFO, fw) Log = new(MyLogger) cookieSecret, _ := Config.GetValue("lessgo", "cookieSecret") Store = sessions.NewCookieStore([]byte(cookieSecret)) SiteName, _ = Config.GetValue("lessgo", "siteName") SiteIcon, _ = Config.GetValue("lessgo", "siteIcon") }