Download
jcs
/subtext
/logger.h
(View History)
jcs logger: Add RFC3164 (BSD) syslog support | Latest amendment: 585 on 2024-02-13 |
1 | /* |
2 | * Copyright (c) 2021-2022 joshua stein <jcs@jcs.org> |
3 | * |
4 | * Permission to use, copy, modify, and distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above |
6 | * copyright notice and this permission notice appear in all copies. |
7 | * |
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ |
16 | |
17 | #ifndef __CHATTER_H__ |
18 | #define __CHATTER_H__ |
19 | |
20 | #include <stdarg.h> |
21 | #include <stdio.h> |
22 | #include "util.h" |
23 | |
24 | #define LOGGER_FONT geneva |
25 | #define LOGGER_FONT_SIZE 9 |
26 | |
27 | struct logger { |
28 | struct focusable *focusable; |
29 | WindowPtr win; |
30 | TEHandle messages_te; |
31 | ControlHandle messages_scroller; |
32 | bool autoflush; |
33 | char *buffered_logs; |
34 | #define LOGGER_BUFFERED_LOG_SIZE 1024 |
35 | size_t buffered_logs_len; |
36 | }; |
37 | |
38 | extern struct logger *logger; |
39 | |
40 | void logger_init(void); |
41 | size_t logger_vprintf(const char *format, va_list ap); |
42 | size_t logger_printf(const char *format, ...); |
43 | void logger_update_title(void); |
44 | |
45 | void syslog_init(void); |
46 | void syslog_deinit(void); |
47 | bool syslog_reinit(void); |
48 | |
49 | #endif |