MCPcopy Create free account
hub / github.com/actiontech/dtle / UpdateLogLevelV2

Function UpdateLogLevelV2

api/handler/v2/log.go:22–43  ·  view source on GitHub ↗

@Id UpdateLogLevelV2 @Description reload log level dynamically. @Tags log @accept application/x-www-form-urlencoded @Security ApiKeyAuth @Param dtle_log_level formData string true "dtle log level" Enums(TRACE, DEBUG, INFO, WARN, ERROR) @Param dtle_debug_job formData string false "dtle debug job" @Su

(c echo.Context)

Source from the content-addressed store, hash-verified

20// @Success 200 {object} models.UpdataLogLevelRespV2
21// @router /v2/log/level [post]
22func UpdateLogLevelV2(c echo.Context) error {
23 logger := handler.NewLogger().Named("UpdateLogLevelV2")
24
25 reqParam := new(models.UpdataLogLevelReqV2)
26 if err := handler.BindAndValidate(logger, c, reqParam); err != nil {
27 return c.JSON(http.StatusInternalServerError, models.BuildBaseResp(err))
28 }
29
30 err := handler.DtleDriver.SetLogLevel(reqParam.DtleLogLevel)
31 if err != nil {
32 return c.String(http.StatusInternalServerError, fmt.Sprintf("failed to set log level to %v. err: %v",
33 reqParam.DtleLogLevel, err))
34 }
35
36 debugJob := handler.DtleDriver.ResetDebugJob(reqParam.DebugJob)
37
38 return c.JSON(http.StatusOK, &models.UpdataLogLevelRespV2{
39 DtleLogLevel: strings.ToUpper(reqParam.DtleLogLevel),
40 DebugJob: debugJob,
41 BaseResp: models.BuildBaseResp(nil),
42 })
43}

Callers

nothing calls this directly

Calls 6

NewLoggerFunction · 0.92
BindAndValidateFunction · 0.92
BuildBaseRespFunction · 0.92
SetLogLevelMethod · 0.80
ResetDebugJobMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected