summaryrefslogtreecommitdiffstats
path: root/src
ModeNameSize
-rw-r--r--arrange.js1663logstatsplain
-rw-r--r--bbox.js1393logstatsplain
-rw-r--r--clip.js1256logstatsplain
-rw-r--r--color.js2142logstatsplain
-rw-r--r--container.js3119logstatsplain
-rw-r--r--default.js1208logstatsplain
-rw-r--r--defs.js171logstatsplain
-rw-r--r--doc.js2796logstatsplain
-rw-r--r--element.js10548logstatsplain
-rw-r--r--ellipse.js1258logstatsplain
-rw-r--r--event.js1372logstatsplain
-rw-r--r--fx.js8952logstatsplain
-rw-r--r--gradient.js2085logstatsplain
-rw-r--r--group.js498logstatsplain
-rw-r--r--image.js579logstatsplain
-rw-r--r--instance.js495logstatsplain
-rw-r--r--line.js1455logstatsplain
-rw-r--r--mask.js1229logstatsplain
-rw-r--r--nested.js320logstatsplain
-rw-r--r--number.js1464logstatsplain
-rw-r--r--path.js468logstatsplain
-rw-r--r--pattern.js831logstatsplain
-rw-r--r--plotable.js1044logstatsplain
-rw-r--r--poly.js1082logstatsplain
-rw-r--r--rbox.js1158logstatsplain
-rw-r--r--rect.js294logstatsplain
-rw-r--r--regex.js814logstatsplain
-rw-r--r--set.js649logstatsplain
-rw-r--r--shape.js139logstatsplain
-rw-r--r--sugar.js2024logstatsplain
-rw-r--r--svg.js1615logstatsplain
-rw-r--r--text.js3513logstatsplain
-rw-r--r--viewbox.js1127logstatsplain
s="p">, map[string]interface{}{ "err": fmt.Sprintf("%v", err), }) } ctx.PlainText(http.StatusOK, []byte("success")) } // PauseLogging pauses logging func PauseLogging(ctx *context.PrivateContext) { log.Pause() ctx.PlainText(http.StatusOK, []byte("success")) } // ResumeLogging resumes logging func ResumeLogging(ctx *context.PrivateContext) { log.Resume() ctx.PlainText(http.StatusOK, []byte("success")) } // ReleaseReopenLogging releases and reopens logging files func ReleaseReopenLogging(ctx *context.PrivateContext) { if err := log.ReleaseReopen(); err != nil { ctx.JSON(http.StatusInternalServerError, map[string]interface{}{ "err": fmt.Sprintf("Error during release and reopen: %v", err), }) return } ctx.PlainText(http.StatusOK, []byte("success")) } // RemoveLogger removes a logger func RemoveLogger(ctx *context.PrivateContext) { group := ctx.Params("group") name := ctx.Params("name") ok, err := log.GetLogger(group).DelLogger(name) if err != nil { ctx.JSON(http.StatusInternalServerError, map[string]interface{}{ "err": fmt.Sprintf("Failed to remove logger: %s %s %v", group, name, err), }) return } if ok { setting.RemoveSubLogDescription(group, name) } ctx.PlainText(http.StatusOK, []byte(fmt.Sprintf("Removed %s %s", group, name))) } // AddLogger adds a logger func AddLogger(ctx *context.PrivateContext) { opts := web.GetForm(ctx).(*private.LoggerOptions) if len(opts.Group) == 0 { opts.Group = log.DEFAULT } if _, ok := opts.Config["flags"]; !ok { switch opts.Group { case "access": opts.Config["flags"] = log.FlagsFromString("") case "router": opts.Config["flags"] = log.FlagsFromString("date,time") default: opts.Config["flags"] = log.FlagsFromString("stdflags") } } if _, ok := opts.Config["colorize"]; !ok && opts.Mode == "console" { if _, ok := opts.Config["stderr"]; ok { opts.Config["colorize"] = log.CanColorStderr } else { opts.Config["colorize"] = log.CanColorStdout } } if _, ok := opts.Config["level"]; !ok { opts.Config["level"] = setting.LogLevel } if _, ok := opts.Config["stacktraceLevel"]; !ok { opts.Config["stacktraceLevel"] = setting.StacktraceLogLevel } if opts.Mode == "file" { if _, ok := opts.Config["maxsize"]; !ok { opts.Config["maxsize"] = 1 << 28 } if _, ok := opts.Config["maxdays"]; !ok { opts.Config["maxdays"] = 7 } if _, ok := opts.Config["compressionLevel"]; !ok { opts.Config["compressionLevel"] = -1 } } bufferLen := setting.Cfg.Section("log").Key("BUFFER_LEN").MustInt64(10000) byteConfig, err := json.Marshal(opts.Config) if err != nil { log.Error("Failed to marshal log configuration: %v %v", opts.Config, err) ctx.JSON(http.StatusInternalServerError, map[string]interface{}{ "err": fmt.Sprintf("Failed to marshal log configuration: %v %v", opts.Config, err), }) return } config := string(byteConfig) if err := log.NewNamedLogger(opts.Group, bufferLen, opts.Name, opts.Mode, config); err != nil { log.Error("Failed to create new named logger: %s %v", config, err) ctx.JSON(http.StatusInternalServerError, map[string]interface{}{ "err": fmt.Sprintf("Failed to create new named logger: %s %v", config, err), }) return } setting.AddSubLogDescription(opts.Group, setting.SubLogDescription{ Name: opts.Name, Provider: opts.Mode, Config: config, }) ctx.PlainText(http.StatusOK, []byte("success")) }