2012-11-10 17:06:01 +01:00
|
|
|
/****************************************************************************
|
2020-03-03 18:02:43 +01:00
|
|
|
* libs/libc/misc/lib_debug.c
|
2012-11-10 17:06:01 +01:00
|
|
|
*
|
2021-04-02 09:22:52 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you 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
|
2012-11-10 17:06:01 +01:00
|
|
|
*
|
2021-04-02 09:22:52 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2012-11-10 17:06:01 +01:00
|
|
|
*
|
2021-04-02 09:22:52 +02:00
|
|
|
* 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.
|
2012-11-10 17:06:01 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2015-12-30 00:31:17 +01:00
|
|
|
#include "libc.h"
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2014-10-09 01:16:41 +02:00
|
|
|
#ifndef CONFIG_CPP_HAVE_VARARGS
|
2012-11-10 17:06:01 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
2014-10-09 01:16:41 +02:00
|
|
|
* Public Functions
|
2012-11-10 17:06:01 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2019-06-27 15:00:50 +02:00
|
|
|
* Name: _alert, _err, _warn, and _info
|
2012-11-10 17:06:01 +01:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* If the cross-compiler's pre-processor does not support variable
|
2016-06-14 17:07:53 +02:00
|
|
|
* length arguments, then these additional APIs will be built.
|
2012-11-10 17:06:01 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2016-06-21 13:26:08 +02:00
|
|
|
#ifdef CONFIG_DEBUG_ALERT
|
2018-03-04 15:07:07 +01:00
|
|
|
void _alert(const char *format, ...)
|
2016-06-14 17:07:53 +02:00
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, format);
|
2018-03-04 15:07:07 +01:00
|
|
|
vsyslog(LOG_EMERG, format, ap);
|
2016-06-14 17:07:53 +02:00
|
|
|
va_end(ap);
|
|
|
|
}
|
2016-06-21 13:26:08 +02:00
|
|
|
#endif /* CONFIG_DEBUG_ALERT */
|
2016-06-14 17:07:53 +02:00
|
|
|
|
2016-06-20 20:44:38 +02:00
|
|
|
#ifdef CONFIG_DEBUG_ERROR
|
2018-03-04 15:07:07 +01:00
|
|
|
void _err(const char *format, ...)
|
2012-11-10 17:06:01 +01:00
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
2014-10-09 01:16:41 +02:00
|
|
|
va_start(ap, format);
|
2018-03-04 15:07:07 +01:00
|
|
|
vsyslog(LOG_ERR, format, ap);
|
2014-10-09 01:16:41 +02:00
|
|
|
va_end(ap);
|
2012-11-10 17:06:01 +01:00
|
|
|
}
|
2016-06-20 20:44:38 +02:00
|
|
|
#endif /* CONFIG_DEBUG_ERROR */
|
2016-06-11 20:38:37 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_WARN
|
2018-03-04 15:07:07 +01:00
|
|
|
void _warn(const char *format, ...)
|
2016-06-11 20:38:37 +02:00
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, format);
|
2018-03-04 15:07:07 +01:00
|
|
|
vsyslog(LOG_WARNING, format, ap);
|
2016-06-11 20:38:37 +02:00
|
|
|
va_end(ap);
|
|
|
|
}
|
2016-06-20 17:37:08 +02:00
|
|
|
#endif /* CONFIG_DEBUG_WARN */
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2016-06-11 19:50:18 +02:00
|
|
|
#ifdef CONFIG_DEBUG_INFO
|
2018-03-04 15:07:07 +01:00
|
|
|
void _info(const char *format, ...)
|
2012-11-10 17:06:01 +01:00
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
2014-10-09 01:16:41 +02:00
|
|
|
va_start(ap, format);
|
2018-03-04 15:07:07 +01:00
|
|
|
vsyslog(LOG_INFO, format, ap);
|
2014-10-09 01:16:41 +02:00
|
|
|
va_end(ap);
|
2012-11-10 17:06:01 +01:00
|
|
|
}
|
2016-06-11 19:50:18 +02:00
|
|
|
#endif /* CONFIG_DEBUG_INFO */
|
2016-06-11 20:38:37 +02:00
|
|
|
|
2012-11-10 17:06:01 +01:00
|
|
|
#endif /* CONFIG_CPP_HAVE_VARARGS */
|