Lines Matching full:sh

14 typedef int (*log_backend_cmd_t)(const struct shell *sh,
56 static bool shell_state_precheck(const struct shell *sh) in shell_state_precheck() argument
58 if (sh->log_backend->control_block->state in shell_state_precheck()
60 shell_error(sh, "Shell log backend not initialized."); in shell_state_precheck()
70 static int shell_backend_cmd_execute(const struct shell *sh, in shell_backend_cmd_execute() argument
82 func(sh, backend, argc, argv); in shell_backend_cmd_execute()
84 shell_error(sh, "Invalid backend: %s", name); in shell_backend_cmd_execute()
91 static int log_status(const struct shell *sh, in log_status() argument
100 shell_warn(sh, "Logs are halted!"); in log_status()
103 shell_fprintf(sh, SHELL_NORMAL, "%-40s | current | built-in \r\n", in log_status()
105 shell_fprintf(sh, SHELL_NORMAL, in log_status()
114 shell_fprintf(sh, SHELL_NORMAL, "%-40s | %-7s | %s\r\n", in log_status()
123 static int cmd_log_self_status(const struct shell *sh, in cmd_log_self_status() argument
126 if (!shell_state_precheck(sh)) { in cmd_log_self_status()
130 log_status(sh, sh->log_backend->backend, argc, argv); in cmd_log_self_status()
134 static int cmd_log_backend_status(const struct shell *sh, in cmd_log_backend_status() argument
137 shell_backend_cmd_execute(sh, argc, argv, log_status); in cmd_log_backend_status()
157 static void filters_set(const struct shell *sh, in filters_set() argument
167 shell_warn(sh, "Backend not active."); in filters_set()
183 shell_warn(sh, "%s: level set to %s.", in filters_set()
187 shell_error(sh, "%s: unknown source name.", argv[i]); in filters_set()
204 static int log_enable(const struct shell *sh, in log_enable() argument
214 shell_error(sh, "Invalid severity: %s", argv[1]); in log_enable()
219 filters_set(sh, backend, argc - 2, &argv[2], severity_level); in log_enable()
223 static int cmd_log_self_enable(const struct shell *sh, in cmd_log_self_enable() argument
226 if (!shell_state_precheck(sh)) { in cmd_log_self_enable()
230 return log_enable(sh, sh->log_backend->backend, argc, argv); in cmd_log_self_enable()
233 static int cmd_log_backend_enable(const struct shell *sh, in cmd_log_backend_enable() argument
236 return shell_backend_cmd_execute(sh, argc, argv, log_enable); in cmd_log_backend_enable()
239 static int log_disable(const struct shell *sh, in log_disable() argument
244 filters_set(sh, backend, argc - 1, &argv[1], LOG_LEVEL_NONE); in log_disable()
248 static int cmd_log_self_disable(const struct shell *sh, in cmd_log_self_disable() argument
251 if (!shell_state_precheck(sh)) { in cmd_log_self_disable()
255 return log_disable(sh, sh->log_backend->backend, argc, argv); in cmd_log_self_disable()
258 static int cmd_log_backend_disable(const struct shell *sh, in cmd_log_backend_disable() argument
261 return shell_backend_cmd_execute(sh, argc, argv, log_disable); in cmd_log_backend_disable()
288 static int log_halt(const struct shell *sh, in log_halt() argument
298 static int cmd_log_self_halt(const struct shell *sh, in cmd_log_self_halt() argument
301 if (!shell_state_precheck(sh)) { in cmd_log_self_halt()
305 return log_halt(sh, sh->log_backend->backend, argc, argv); in cmd_log_self_halt()
308 static int cmd_log_backend_halt(const struct shell *sh, in cmd_log_backend_halt() argument
311 return shell_backend_cmd_execute(sh, argc, argv, log_halt); in cmd_log_backend_halt()
314 static int log_go(const struct shell *sh, in log_go() argument
324 static int cmd_log_self_go(const struct shell *sh, in cmd_log_self_go() argument
327 if (!shell_state_precheck(sh)) { in cmd_log_self_go()
331 return log_go(sh, sh->log_backend->backend, argc, argv); in cmd_log_self_go()
334 static int cmd_log_backend_go(const struct shell *sh, in cmd_log_backend_go() argument
337 return shell_backend_cmd_execute(sh, argc, argv, log_go); in cmd_log_backend_go()
341 static int cmd_log_backends_list(const struct shell *sh, in cmd_log_backends_list() argument
345 shell_fprintf(sh, SHELL_NORMAL, in cmd_log_backends_list()
357 static int cmd_log_mem(const struct shell *sh, size_t argc, char **argv) in cmd_log_mem() argument
366 shell_error(sh, "Failed to get usage (mode does not support it?)"); in cmd_log_mem()
370 shell_print(sh, "Log message buffer utilization report:"); in cmd_log_mem()
371 shell_print(sh, "\tCapacity: %u bytes", size); in cmd_log_mem()
372 shell_print(sh, "\tCurrently in use: %u bytes", used); in cmd_log_mem()
376 shell_print(sh, "Enable CONFIG_LOG_MEM_UTILIZATION to get maximum usage"); in cmd_log_mem()
380 shell_print(sh, "\tMaximum usage: %u bytes", max); in cmd_log_mem()