2016-06-19 23:12:33 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* drivers/syslog/syslog_initialize.c
|
|
|
|
*
|
2021-03-04 14:10:42 +08: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
|
2016-06-19 23:12:33 +08:00
|
|
|
*
|
2021-03-04 14:10:42 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2016-06-19 23:12:33 +08:00
|
|
|
*
|
2021-03-04 14:10:42 +08: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.
|
2016-06-19 23:12:33 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-06-22 06:59:46 +08:00
|
|
|
#include <nuttx/syslog/ramlog.h>
|
2016-06-19 23:12:33 +08:00
|
|
|
#include <nuttx/syslog/syslog.h>
|
2020-02-19 11:30:07 +08:00
|
|
|
#include <nuttx/syslog/syslog_rpmsg.h>
|
2016-06-19 23:12:33 +08:00
|
|
|
|
|
|
|
#include "syslog.h"
|
|
|
|
|
2016-06-20 01:16:12 +08:00
|
|
|
#ifndef CONFIG_ARCH_SYSLOG
|
|
|
|
|
2016-06-19 23:12:33 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: syslog_initialize
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* One power up, the SYSLOG facility is non-existent or limited to very
|
2016-06-20 01:16:12 +08:00
|
|
|
* low-level output. This function is called later in the initialization
|
2016-06-19 23:12:33 +08:00
|
|
|
* sequence after full driver support has been initialized. It installs
|
|
|
|
* the configured SYSLOG drivers and enables full SYSLOGing capability.
|
|
|
|
*
|
2016-06-20 01:16:12 +08:00
|
|
|
* This function performs these basic operations:
|
|
|
|
*
|
|
|
|
* - Initialize the SYSLOG device
|
|
|
|
* - Call syslog_channel() to begin using that device.
|
|
|
|
*
|
|
|
|
* If CONFIG_ARCH_SYSLOG is selected, then the architecture-specifica
|
|
|
|
* logic will provide its own SYSLOG device initialize which must include
|
|
|
|
* as a minimum a call to syslog_channel() to use the device.
|
|
|
|
*
|
2016-06-19 23:12:33 +08:00
|
|
|
* Input Parameters:
|
2020-02-18 16:40:59 +08:00
|
|
|
* None
|
2016-06-19 23:12:33 +08:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
|
|
|
* any failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-02-18 16:40:59 +08:00
|
|
|
int syslog_initialize(void)
|
2016-06-19 23:12:33 +08:00
|
|
|
{
|
2016-06-21 21:52:24 +08:00
|
|
|
int ret = OK;
|
2016-06-19 23:12:33 +08:00
|
|
|
|
2016-06-19 23:39:21 +08:00
|
|
|
#if defined(CONFIG_SYSLOG_CHAR)
|
2020-02-18 16:40:59 +08:00
|
|
|
/* Enable use of a character device as the SYSLOG device */
|
2016-06-20 03:03:20 +08:00
|
|
|
|
2021-06-03 18:24:49 +08:00
|
|
|
syslog_dev_channel();
|
2016-06-21 23:59:09 +08:00
|
|
|
#elif defined(CONFIG_SYSLOG_CONSOLE)
|
2020-02-18 16:40:59 +08:00
|
|
|
/* Use the console device as the SYSLOG device */
|
2016-06-19 23:12:33 +08:00
|
|
|
|
2021-06-03 18:24:49 +08:00
|
|
|
syslog_console_channel();
|
2020-02-18 16:40:59 +08:00
|
|
|
#endif
|
2016-06-19 23:41:35 +08:00
|
|
|
|
2020-02-18 16:40:59 +08:00
|
|
|
#ifdef CONFIG_RAMLOG_SYSLOG
|
|
|
|
ramlog_syslog_register();
|
2016-06-19 23:12:33 +08:00
|
|
|
#endif
|
|
|
|
|
2018-11-09 22:49:07 +08:00
|
|
|
#ifdef CONFIG_SYSLOG_CHARDEV
|
2020-02-18 16:40:59 +08:00
|
|
|
syslog_register();
|
2018-11-09 22:49:07 +08:00
|
|
|
#endif
|
|
|
|
|
2020-04-29 18:10:10 +08:00
|
|
|
#ifdef CONFIG_SYSLOG_RPMSG
|
2020-02-19 11:30:07 +08:00
|
|
|
syslog_rpmsg_init();
|
|
|
|
#endif
|
|
|
|
|
2016-06-19 23:12:33 +08:00
|
|
|
return ret;
|
|
|
|
}
|
2016-06-20 01:16:12 +08:00
|
|
|
|
|
|
|
#endif /* CONFIG_ARCH_SYSLOG */
|