xref: /dpdk/lib/log/log_internal.h (revision 259f6f78094d0fa33ce2ffe298b8df526c535f3b)
109ce4131SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
209ce4131SBruce Richardson  * Copyright 2021 Mellanox Technologies, Ltd
309ce4131SBruce Richardson  */
409ce4131SBruce Richardson 
509ce4131SBruce Richardson #ifndef LOG_INTERNAL_H
609ce4131SBruce Richardson #define LOG_INTERNAL_H
709ce4131SBruce Richardson 
862ae1149SStephen Hemminger #include <stdbool.h>
909ce4131SBruce Richardson #include <stdio.h>
1009ce4131SBruce Richardson #include <stdint.h>
1162ae1149SStephen Hemminger #include <time.h>
1209ce4131SBruce Richardson 
1309ce4131SBruce Richardson #include <rte_compat.h>
1409ce4131SBruce Richardson 
1509ce4131SBruce Richardson /*
1609ce4131SBruce Richardson  * Initialize the default log stream.
1709ce4131SBruce Richardson  */
1809ce4131SBruce Richardson __rte_internal
1998513036SStephen Hemminger void eal_log_init(const char *id);
2009ce4131SBruce Richardson 
2109ce4131SBruce Richardson /*
2209ce4131SBruce Richardson  * Save a log option for later.
2309ce4131SBruce Richardson  */
2409ce4131SBruce Richardson __rte_internal
2509ce4131SBruce Richardson int eal_log_save_regexp(const char *regexp, uint32_t level);
2609ce4131SBruce Richardson __rte_internal
2709ce4131SBruce Richardson int eal_log_save_pattern(const char *pattern, uint32_t level);
2809ce4131SBruce Richardson 
2998513036SStephen Hemminger __rte_internal
3098513036SStephen Hemminger int eal_log_syslog(const char *name);
3198513036SStephen Hemminger 
329da0dc6cSStephen Hemminger __rte_internal
339da0dc6cSStephen Hemminger int eal_log_journal(const char *opt);
349da0dc6cSStephen Hemminger 
3509ce4131SBruce Richardson /*
3609ce4131SBruce Richardson  * Convert log level to string.
3709ce4131SBruce Richardson  */
3809ce4131SBruce Richardson __rte_internal
3909ce4131SBruce Richardson const char *eal_log_level2str(uint32_t level);
4009ce4131SBruce Richardson 
4109ce4131SBruce Richardson /*
4209ce4131SBruce Richardson  * Close the default log stream
4309ce4131SBruce Richardson  */
4409ce4131SBruce Richardson __rte_internal
4509ce4131SBruce Richardson void rte_eal_log_cleanup(void);
4609ce4131SBruce Richardson 
4762ae1149SStephen Hemminger /*
4862ae1149SStephen Hemminger  * Add timestamp to console logs
4962ae1149SStephen Hemminger  */
5062ae1149SStephen Hemminger __rte_internal
5162ae1149SStephen Hemminger int eal_log_timestamp(const char *fmt);
5262ae1149SStephen Hemminger 
53*259f6f78SStephen Hemminger /*
54*259f6f78SStephen Hemminger  * Enable or disable color in log messages
55*259f6f78SStephen Hemminger  */
56*259f6f78SStephen Hemminger __rte_internal
57*259f6f78SStephen Hemminger int eal_log_color(const char *mode);
5862ae1149SStephen Hemminger 
5909ce4131SBruce Richardson #endif /* LOG_INTERNAL_H */
60