4 * This file is part of BeRTOS.
6 * Bertos is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * As a special exception, you may use this file as part of a free software
21 * library without restriction. Specifically, if other files instantiate
22 * templates or use macros or inline functions from this file, or you compile
23 * this file and link it with other files to produce an executable, this
24 * file does not by itself cause the resulting executable to be covered by
25 * the GNU General Public License. This exception does not however
26 * invalidate any other reasons why the executable file might be covered by
27 * the GNU General Public License.
29 * Copyright 2012 Develer S.r.l. (http://www.develer.com/)
33 * \brief SYSLOG log all debug message in the BeRTOS code, with the
34 * respective log level, to one syslog server on the udp protocol.
36 * The usage pattern is as follows:
38 * // Init the network, es using dhcp:
40 * // Initialize TCP/IP stack
41 * tcpip_init(NULL, NULL);
43 * // Bring up the network interface
44 * netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ethernetif_init, tcpip_input);
45 * netif_set_default(&netif);
46 * netif_set_up(&netif);
49 * while (!netif.ip_addr.addr)
50 * timer_delay(DHCP_FINE_TIMER_MSECS);
52 * // lwip address struct
53 * struct ip_addr server_addr;
54 * // convert address to ip_address
55 * IP4_ADDR(&server_addr, 192, 168, 0, 2);
57 * // init the syslog module
58 * syslog_init(&syslog, server_addr);
60 * // now all LOG_*(message) are logged on
62 * // see the cfg_syslog.h for all settings.
66 * \author Daniele Basile <asterix@develer.com>
68 * $WIZ$ module_name = "syslog"
69 * $WIZ$ module_configuration = "bertos/cfg/cfg_syslog.h"
70 * $WIZ$ module_depends = "lwip", "debug"
76 #include <lwip/netif.h>
77 #include <lwip/ip_addr.h>
81 struct netconn *syslog_server;
82 struct netbuf *send_buf;
83 struct ip_addr server_addr;
89 uint32_t syslog_count(void);
90 struct ip_addr syslog_ip(void);
91 void syslog_setIp(struct ip_addr addr);
93 int syslog_printf(const char *fmt, ...);
95 void syslog_init(SysLog *syslog_ctx, struct ip_addr addr);
97 #endif /* NET_SYSLOG_H */