Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
printk.h
Go to the documentation of this file.
1/* printk.h - low-level debug output */
2
3/*
4 * Copyright (c) 2010-2012, 2014 Wind River Systems, Inc.
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8#ifndef ZEPHYR_INCLUDE_SYS_PRINTK_H_
9#define ZEPHYR_INCLUDE_SYS_PRINTK_H_
10
11#include <toolchain.h>
12#include <stddef.h>
13#include <stdarg.h>
14#include <inttypes.h>
15#if defined(CONFIG_LOG_PRINTK) && defined(CONFIG_LOG2)
16#include <logging/log.h>
17#endif
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
50#ifdef CONFIG_PRINTK
51
52#if defined(CONFIG_LOG_PRINTK) && defined(CONFIG_LOG2)
53#define printk(...) Z_LOG_PRINTK(__VA_ARGS__)
54static inline __printf_like(1, 0) void vprintk(const char *fmt, va_list ap)
55{
56 z_log_msg2_runtime_vcreate(CONFIG_LOG_DOMAIN_ID, NULL,
58 fmt, ap);
59}
60#else
61extern __printf_like(1, 2) void printk(const char *fmt, ...);
62extern __printf_like(1, 0) void vprintk(const char *fmt, va_list ap);
63#endif /* defined(CONFIG_LOG_PRINTK) && defined(CONFIG_LOG) */
64
65#else
66static inline __printf_like(1, 2) void printk(const char *fmt, ...)
67{
68 ARG_UNUSED(fmt);
69}
70
71static inline __printf_like(1, 0) void vprintk(const char *fmt, va_list ap)
72{
73 ARG_UNUSED(fmt);
74 ARG_UNUSED(ap);
75}
76#endif
77
78extern __printf_like(3, 4) int snprintk(char *str, size_t size,
79 const char *fmt, ...);
80extern __printf_like(3, 0) int vsnprintk(char *str, size_t size,
81 const char *fmt, va_list ap);
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif
void
Definition: eswifi_shell.c:15
#define CONFIG_LOG_DOMAIN_ID
Definition: log_core.h:34
#define LOG_LEVEL_INTERNAL_RAW_STRING
Log level value used to indicate log entry that should not be formatted (raw string).
Definition: log_core.h:458
int snprintk(char *str, size_t size, const char *fmt,...)
static void vprintk(const char *fmt, va_list ap)
Definition: printk.h:71
static void printk(const char *fmt,...)
Print kernel debugging message.
Definition: printk.h:66
int vsnprintk(char *str, size_t size, const char *fmt, va_list ap)
Macros to abstract toolchain specific capabilities.