logging: move sys_log to subsys/logging

Move logging out of misc/ to its own subsystem. Anything related to
logging and any new logging features or backends could be added here
instead of the generic location in misc/ which is overcrowded with
options that are not related to eachother.

Jira: ZEP-1467
Change-Id: If6a3ea625c3a3562a7a61a0ba5fd7e6ca75518ba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2016-12-17 12:56:56 -05:00 committed by Anas Nashif
commit a9e879e273
80 changed files with 173 additions and 149 deletions

View file

@ -37,7 +37,7 @@
(*((volatile uint32_t *)(SCSS_REGISTER_BASE+offset)))
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_ARC_INIT_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
/**
*

View file

@ -21,7 +21,6 @@ The Zephyr APIs are used the same way on all SoCs and boards.
bluetooth.rst
io_interfaces.rst
event_logger.rst
system_log.rst
power_management_api
file_system
testing

View file

@ -15,3 +15,4 @@ to applications.
sensor
power_management.rst
shell
system_log

View file

@ -1,7 +1,7 @@
.. _system_log:
System Log API
#################
Logging
########
.. contents::
:depth: 1
@ -31,14 +31,14 @@ There are two configuration categories: configurations per module and global
configurations. When logging is enabled globally, it works for modules. However,
modules can disable logging locally. Every module can specify its own logging
level. The module must define the :c:macro:`SYS_LOG_LEVEL` macro before
including the :file:`<misc/sys_log.h>` header file to do so. Unless a global
including the :file:`<logging/sys_log.h>` header file to do so. Unless a global
override is set, the module logging level will be honored. The global override
can only increase the logging level. It cannot be used to lower module logging
levels that were previously set higher.
You can set a local domain to differentiate messages. When no domain is set,
then the ``[general]`` domain appears before the message. Define the
:c:macro:`SYS_LOG_DOMAIN` macro before including the :file:`misc/sys_log.h`
:c:macro:`SYS_LOG_DOMAIN` macro before including the :file:`logging/sys_log.h`
header file to set the domain.
When several macros are active, the printed messages can be differentiated in
@ -47,7 +47,7 @@ two ways: by a tag printed before the message or by ANSI colors. See the
Kconfig options for more information.
Define the :c:macro:`SYS_LOG_NO_NEWLINE` macro before including the
:file:`misc/sys_log.h` header file to prevent macros appending a new line at the
:file:`logging/sys_log.h` header file to prevent macros appending a new line at the
end of the logging message.
.. _global_kconfig:

View file

@ -22,7 +22,7 @@
#include <misc/util.h>
#define SYS_LOG_NO_NEWLINE
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_ADC_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <string.h>
#include <init.h>

View file

@ -30,7 +30,7 @@
#include <clock_control/quark_se_clock_control.h>
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_CLOCK_CONTROL_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
struct quark_se_clock_control_config {
uint32_t base_address;

View file

@ -31,7 +31,7 @@
#define SYS_LOG_DOMAIN "ETH DW"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_ETHERNET_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
static inline uint32_t eth_read(uint32_t base_addr, uint32_t offset)
{

View file

@ -17,7 +17,7 @@
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_ETHERNET_LEVEL
#define SYS_LOG_DOMAIN "dev/enc28j60"
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <zephyr.h>
#include <device.h>

View file

@ -27,7 +27,7 @@
#define SYS_LOG_DOMAIN "dev/eth_ksdk"
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <board.h>
#include <device.h>

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <kernel.h>
#include <device.h>
#include <string.h>

View file

@ -29,7 +29,7 @@
#include "gpio_pcal9535a.h"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_GPIO_PCAL9535A_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
/* Register definitions */
#define REG_INPUT_PORT0 0x00

View file

@ -28,7 +28,7 @@
#include "gpio_utils.h"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_GPIO_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
/* Define GPIO_SCH_LEGACY_IO_PORTS_ACCESS
* inside soc.h if the GPIO controller

View file

@ -25,7 +25,7 @@
#define SYS_LOG_DOMAIN "Grove LCD"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_GROVE_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define SLEEP_IN_US(_x_) ((_x_) * 1000)

View file

@ -22,7 +22,7 @@
#define SYS_LOG_DOMAIN "GROVE_LIGHT_SENSOR"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_GROVE_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
struct gls_data {
struct device *adc;

View file

@ -22,7 +22,7 @@
#define SYS_LOG_DOMAIN "GROVE_TEMPERATURE_SENSOR"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_GROVE_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
/* thermistor Nominal B-Constant */
#if defined(CONFIG_GROVE_TEMPERATURE_SENSOR_V1_0)

View file

@ -45,7 +45,7 @@
#include "i2c_atmel_sam3.h"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_I2C_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
/* for use with dev_data->state */
#define STATE_READY 0

View file

@ -44,7 +44,7 @@
#include "i2c_dw_registers.h"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_I2C_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
static inline void _i2c_dw_data_ask(struct device *dev)
{

View file

@ -28,7 +28,7 @@
#include "i2c_stm32lx.h"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_I2C_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
/* convenience defines */
#define DEV_CFG(dev) \

View file

@ -18,7 +18,7 @@
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_TI_CC2520_LEVEL
#define SYS_LOG_DOMAIN "dev/cc2520"
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <errno.h>

View file

@ -16,7 +16,7 @@
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_UPIPE_15_4_LEVEL
#define SYS_LOG_DOMAIN "net/ieee802154/upipe/"
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <errno.h>

View file

@ -64,7 +64,7 @@
#undef COMBINE_MODE_SUPPORT
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_PWM_K64_FTM_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
/* Maximum PWM outputs */
#define MAX_PWM_OUT 8

View file

@ -17,7 +17,7 @@
#include <drivers/rand32.h>
#include <drivers/system_timer.h>
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <init.h>
#include "fsl_rnga.h"

View file

@ -21,7 +21,7 @@
#define SYS_LOG_DOMAIN "AK8975"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define AK8975_REG_CHIP_ID 0x00
#define AK8975_CHIP_ID 0x48

View file

@ -166,5 +166,5 @@ int bma280_init_interrupt(struct device *dev);
#define SYS_LOG_DOMAIN "BMA280"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* __SENSOR_BMA280_H__ */

View file

@ -185,5 +185,5 @@ int bmc150_magn_init_interrupt(struct device *dev);
#define SYS_LOG_DOMAIN "BMC150_MAGN"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* __SENSOR_BMC150_MAGN_H__ */

View file

@ -148,5 +148,5 @@ struct bme280_data {
#define SYS_LOG_DOMAIN "BME280"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* __SENSOR_BME280_H__ */

View file

@ -239,5 +239,5 @@ int bmg160_slope_config(struct device *dev, enum sensor_attribute attr,
#define SYS_LOG_DOMAIN "BMG160"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* _BMG160_H_ */

View file

@ -493,5 +493,5 @@ int32_t bmi160_gyr_reg_val_to_range(uint8_t reg_val);
#define SYS_LOG_DOMAIN "BMI160"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* _BMI160_H_ */

View file

@ -21,7 +21,7 @@
#define SYS_LOG_DOMAIN "DHT"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define DHT_START_SIGNAL_DURATION 18000
#define DHT_SIGNAL_MAX_WAIT_DURATION 100

View file

@ -20,7 +20,7 @@
#define SYS_LOG_DOMAIN "FXOS8700"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define FXOS8700_REG_STATUS 0x00
#define FXOS8700_REG_OUTXMSB 0x01

View file

@ -37,5 +37,5 @@ struct hdc1008_data {
#define SYS_LOG_DOMAIN "HDC1008"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif

View file

@ -24,7 +24,7 @@
#define SYS_LOG_DOMAIN "HMC5883L"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define HMC5883L_I2C_ADDR 0x1E

View file

@ -95,5 +95,5 @@ struct hp206c_device_data {
#define SYS_LOG_DOMAIN "HP206C"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* _SENSOR_HP206C_H_ */

View file

@ -24,7 +24,7 @@
#define SYS_LOG_DOMAIN "HTS221"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define HTS221_I2C_ADDR 0x5F
#define HTS221_AUTOINCREMENT_ADDR BIT(7)

View file

@ -157,5 +157,5 @@ int isl29035_init_interrupt(struct device *dev);
#define SYS_LOG_DOMAIN "ISL29035"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* _SENSOR_ISL29035_H_ */

View file

@ -125,5 +125,5 @@ int lis3dh_init_interrupt(struct device *dev);
#define SYS_LOG_DOMAIN "LIS3DH"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* __SENSOR_LIS3DH__ */

View file

@ -24,7 +24,7 @@
#define SYS_LOG_DOMAIN "LIS3MDL"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define LIS3MDL_I2C_ADDR_BASE 0x1C
#define LIS3MDL_I2C_ADDR_MASK (~BIT(1))

View file

@ -170,5 +170,5 @@ struct lps25hb_data {
#define SYS_LOG_DOMAIN "LPS25HB"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* __SENSOR_LPS25HB_H__ */

View file

@ -504,5 +504,5 @@ struct lsm6ds0_data {
#define SYS_LOG_DOMAIN "LSM6DS0"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* __SENSOR_LSM6DS0_H__ */

View file

@ -265,5 +265,5 @@ int lsm9ds0_gyro_init_interrupt(struct device *dev);
#define SYS_LOG_DOMAIN "LSM9DS0_GYRO"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* __SENSOR_LSM9DS0_GYRO_H__ */

View file

@ -569,5 +569,5 @@ struct lsm9ds0_mfd_data {
#define SYS_LOG_DOMAIN "LSM9DS0_MFD"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* __SENSOR_LSM9DS0_MFD_H__ */

View file

@ -21,7 +21,7 @@
#define SYS_LOG_DOMAIN "MAX44009"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define MAX44009_I2C_ADDRESS CONFIG_MAX44009_I2C_ADDR

View file

@ -98,5 +98,5 @@ static void mcp9808_setup_interrupt(struct device *dev)
#define SYS_LOG_DOMAIN "MCP9808"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* __SENSOR_MCP9808_H__ */

View file

@ -24,7 +24,7 @@
#define SYS_LOG_DOMAIN "MPU6050"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define MPU6050_REG_CHIP_ID 0x75
#define MPU6050_CHIP_ID 0x68

View file

@ -20,7 +20,7 @@
#define SYS_LOG_DOMAIN "TEMPNRF5"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include "nrf.h"
#include "nrf5_common.h"

View file

@ -115,5 +115,5 @@ int sht3xd_init_interrupt(struct device *dev);
#define SYS_LOG_DOMAIN "SHT3XD"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* _SENSOR_SHT3XD_ */

View file

@ -73,5 +73,5 @@ static inline int sx9500_setup_interrupt(struct device *dev)
#define SYS_LOG_DOMAIN "SX9500"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* __SENSOR_SX9500_H__ */

View file

@ -43,5 +43,5 @@ struct th02_data {
#define SYS_LOG_DOMAIN "TH02"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* _SENSOR_TH02_ */

View file

@ -90,5 +90,5 @@ int tmp007_init_interrupt(struct device *dev);
#define SYS_LOG_DOMAIN "TMP007"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#endif /* _SENSOR_TMP007_ */

View file

@ -24,7 +24,7 @@
#define SYS_LOG_DOMAIN "TMP112"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define TMP112_I2C_ADDRESS CONFIG_TMP112_I2C_ADDR

View file

@ -22,7 +22,7 @@
#if defined(CONFIG_SLIP_DEBUG)
#define SYS_LOG_DOMAIN "slip"
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <stdio.h>
#endif

View file

@ -39,7 +39,7 @@
#define SYS_LOG_DOMAIN "SPI DW"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SPI_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#if (CONFIG_SYS_LOG_SPI_LEVEL == 4)
#define DBG_COUNTER_INIT() \

View file

@ -38,7 +38,7 @@
#define SYS_LOG_DOMAIN "SPI Intel"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SPI_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define DEFINE_MM_REG_READ(__reg, __off, __sz) \

View file

@ -53,7 +53,7 @@
#include <misc/util.h>
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SPI_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <board.h>
#include <init.h>

View file

@ -33,7 +33,7 @@
#include "clk.h"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_USB_DW_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
/* convert from endpoint address to hardware endpoint index */
#define USB_DW_EP_ADDR2IDX(ep) ((ep) & ~USB_EP_DIR_MASK)

View file

@ -54,7 +54,7 @@ void bt_log(int prio, const char *fmt, ...);
#define SYS_LOG_DOMAIN "bt"
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define BT_DBG(fmt, ...) SYS_LOG_DBG("(%p) " fmt, k_current_get(), \
##__VA_ARGS__)

View file

@ -68,7 +68,7 @@ struct net_buf;
struct net_context;
struct net_if;
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <string.h>
enum net_verdict {

View file

@ -221,77 +221,6 @@ source "misc/debug/Kconfig"
endmenu
menu "Logging Options"
config SYS_LOG
bool
prompt "Enable Logging"
depends on PRINTK
default n
help
Global switch for logging, when turned off log calls will not be
executed.
config SYS_LOG_SHOW_TAGS
bool
prompt "Prepend level tags to logs"
depends on SYS_LOG
default y
help
Prefixes all log lines with an identifier to the log level submitted in
the C code.
config SYS_LOG_SHOW_COLOR
bool
prompt "Use colored logs"
depends on SYS_LOG
default n
help
Use color in the logs. This requires an ANSI capable terminal.
config SYS_LOG_DEFAULT_LEVEL
int
prompt "Default log level"
depends on SYS_LOG
default 0
range 0 4
help
Sets log level for modules which don't specify it explicitly. When
set to 0 it means log wont be activated for those modules.
Levels are:
0 OFF, do not write by default
1 ERROR, default to only write SYS_LOG_ERR
2 WARNING, default to write SYS_LOG_WRN in adition to previous level
3 INFO, default to write SYS_LOG_INF in adition to previous levels
4 DEBUG, default to write SYS_LOG_DBG in adition to previous levels
config SYS_LOG_OVERRIDE_LEVEL
int
prompt "Override lowest log level"
depends on SYS_LOG
default 0
range 0 4
help
Forces a minimum log level for all modules. Modules use their
specified level if it is greater than this option, otherwise they use
the level specified by this option instead of their default or
whatever was manually set.
Levels are:
0 OFF, do not override
1 ERROR, override to write SYS_LOG_ERR
2 WARNING, override to write SYS_LOG_WRN in adition to previous level
3 INFO, override to write SYS_LOG_INF in adition to previous levels
4 DEBUG, override to write SYS_LOG_DBG in adition to previous levels
config SYS_LOG_EXT_HOOK
bool
prompt "Use external hook function for logging"
depends on SYS_LOG
default n
help
Use external hook function for logging.
endmenu
menu "System Monitoring Options"
config PERFORMANCE_METRICS

View file

@ -1,9 +1,13 @@
obj-y =
obj-$(CONFIG_CPLUSPLUS) += cpp_virtual.o cpp_vtable.o \
cpp_init_array.o cpp_ctors.o cpp_dtors.o
obj-$(CONFIG_PRINTK) += printk.o
obj-$(CONFIG_REBOOT) += reboot.o
obj-$(CONFIG_RING_BUFFER) += ring_buffer.o
obj-y += sys_log.o
obj-y += generated/
obj-y += debug/

View file

@ -23,7 +23,7 @@
#include <zephyr.h>
#include <arch/cpu.h>
#include <misc/byteorder.h>
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <misc/util.h>
#include <device.h>

View file

@ -19,7 +19,7 @@
#include <device.h>
#include <uart.h>
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <misc/util.h>
#include <net/buf.h>

View file

@ -18,7 +18,7 @@
#include <zephyr.h>
#include <misc/printk.h>
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <stdio.h>
#include <misc/ring_buffer.h>

View file

@ -32,7 +32,7 @@
#include <net/buf.h>
#define SYS_LOG_DOMAIN "main"
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <net_private.h>

View file

@ -16,7 +16,7 @@
#define SYS_LOG_LEVEL 3
#define SYS_LOG_DOMAIN "wpanusb"
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <sections.h>
#include <toolchain.h>

View file

@ -17,7 +17,7 @@
/* Sample to put the device in USB mass storage mode backed on a 16k RAMDisk. */
#include <zephyr.h>
#include <misc/sys_log.h>
#include <logging/sys_log.h>
void main(void)
{

View file

@ -43,7 +43,7 @@
#include <uart.h>
#include <string.h>
#include <misc/byteorder.h>
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include "cdc_acm.h"
#include "usb_device.h"
#include "usb_common.h"

View file

@ -22,3 +22,5 @@ source "subsys/usb/Kconfig"
source "subsys/bluetooth/Kconfig"
source "subsys/net/Kconfig"
source "subsys/logging/Kconfig"

View file

@ -2,3 +2,4 @@ obj-$(CONFIG_FILE_SYSTEM) += fs/
obj-$(CONFIG_USB) += usb/
obj-$(CONFIG_BLUETOOTH) += bluetooth/
obj-$(CONFIG_NET_BUF) += net/
obj-y += logging/

86
subsys/logging/Kconfig Normal file
View file

@ -0,0 +1,86 @@
#
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
menu "Logging Options"
config SYS_LOG
bool
prompt "Enable Logging"
depends on PRINTK
default n
help
Global switch for logging, when turned off log calls will not be
executed.
config SYS_LOG_SHOW_TAGS
bool
prompt "Prepend level tags to logs"
depends on SYS_LOG
default y
help
Prefixes all log lines with an identifier to the log level submitted in
the C code.
config SYS_LOG_SHOW_COLOR
bool
prompt "Use colored logs"
depends on SYS_LOG
default n
help
Use color in the logs. This requires an ANSI capable terminal.
config SYS_LOG_DEFAULT_LEVEL
int
prompt "Default log level"
depends on SYS_LOG
default 0
range 0 4
help
Sets log level for modules which don't specify it explicitly. When
set to 0 it means log wont be activated for those modules.
Levels are:
0 OFF, do not write by default
1 ERROR, default to only write SYS_LOG_ERR
2 WARNING, default to write SYS_LOG_WRN in adition to previous level
3 INFO, default to write SYS_LOG_INF in adition to previous levels
4 DEBUG, default to write SYS_LOG_DBG in adition to previous levels
config SYS_LOG_OVERRIDE_LEVEL
int
prompt "Override lowest log level"
depends on SYS_LOG
default 0
range 0 4
help
Forces a minimum log level for all modules. Modules use their
specified level if it is greater than this option, otherwise they use
the level specified by this option instead of their default or
whatever was manually set.
Levels are:
0 OFF, do not override
1 ERROR, override to write SYS_LOG_ERR
2 WARNING, override to write SYS_LOG_WRN in adition to previous level
3 INFO, override to write SYS_LOG_INF in adition to previous levels
4 DEBUG, override to write SYS_LOG_DBG in adition to previous levels
config SYS_LOG_EXT_HOOK
bool
prompt "Use external hook function for logging"
depends on SYS_LOG
default n
help
Use external hook function for logging.
endmenu

2
subsys/logging/Makefile Normal file
View file

@ -0,0 +1,2 @@
obj-y += sys_log.o

View file

@ -15,7 +15,7 @@
* .
*/
#include <misc/sys_log.h>
#include <logging/sys_log.h>
void syslog_hook_default(const char *fmt, ...)
{

View file

@ -27,7 +27,7 @@
#if defined(CONFIG_NET_BUF_DEBUG)
#define SYS_LOG_DOMAIN "net/buf"
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define NET_BUF_DBG(fmt, ...) SYS_LOG_DBG("(%p) " fmt, k_current_get(), \
##__VA_ARGS__)

View file

@ -26,7 +26,7 @@
#include <string.h>
#include <errno.h>
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#include <board.h>
#include <device.h>

View file

@ -53,7 +53,7 @@
/* definitions */
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_USB_CDC_ACM_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define DEV_DATA(dev) \
((struct cdc_acm_dev_data_t * const)(dev)->driver_data)

View file

@ -43,7 +43,7 @@
#include "usb_common.h"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_USB_MASS_STORAGE_LEVEL
#include <misc/sys_log.h>
#include <logging/sys_log.h>
/* Misc. macros */
#define LOW_BYTE(x) ((x) & 0xFF)

View file

@ -68,7 +68,7 @@
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_USB_LEVEL
#define SYS_LOG_NO_NEWLINE
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define MAX_DESC_HANDLERS 4 /** Device, interface, endpoint, other */

View file

@ -34,7 +34,7 @@
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG
#define SYS_LOG_DOMAIN "bttester"
#include <misc/sys_log.h>
#include <logging/sys_log.h>
struct btp_hdr {
uint8_t service;

View file

@ -22,7 +22,7 @@
*/
#include <ztest.h>
#include <misc/sys_log.h>
#include <logging/sys_log.h>
#define N_VALUES 10

View file

@ -18,7 +18,7 @@
#include <ztest.h>
#include <misc/ring_buffer.h>
#include <misc/sys_log.h>
#include <logging/sys_log.h>
SYS_RING_BUF_DECLARE_POW2(ring_buf, 8);