ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
logging.c File Reference

Logging category options. More...

Go to the source code of this file.

Variables

const registry_entry_t g_logging_entries []
 

Detailed Description

Logging category options.

Binary-level logging and output control options including log files, verbosity levels, and grep filtering.

Author
Zachary Fogg me@zf.nosp@m.o.gg
Date
January 2026

Definition in file options/registry/logging.c.

Variable Documentation

◆ g_logging_entries

const registry_entry_t g_logging_entries[]

Definition at line 21 of file options/registry/logging.c.

21 {
22 // LOGGING GROUP (binary-level)
23 {"log-file",
24 'L',
26 offsetof(options_t, log_file),
27 NULL, // Use mode_default_getter instead
28 0,
29#ifndef NDEBUG
30 "Set FILE as path for log file (default: current directory; filenames: server.log, client.log, mirror.log, "
31 "acds.log, discovery.log).",
32#else
33 "Set FILE as path for log file (default: $TMPDIR/ascii-chat/ or %TEMP%\\ascii-chat\\; filenames: server.log, "
34 "client.log, mirror.log, acds.log, discovery.log).",
35#endif
36 "LOGGING",
37 "FILE",
38 false,
39 "ASCII_CHAT_LOG_FILE",
40 NULL,
42 false,
43 false,
44#ifndef NDEBUG
46#else
48#endif
49 {0},
51 {"log-level",
52 '\0',
54 offsetof(options_t, log_level),
55 &default_log_level_value,
56 sizeof(log_level_t),
57 "Set log level: dev, debug, info, warn, error, fatal. Logs at or above this level are written.",
58 "LOGGING",
59 NULL,
60 false,
61 "ASCII_CHAT_LOG_LEVEL",
62 NULL,
64 false,
65 false,
67 {.enum_values = g_log_level_values,
68 .enum_descriptions = g_log_level_descs,
69 .enum_integer_values = g_log_level_integers,
70 .input_type = OPTION_INPUT_ENUM},
71 NULL},
72 {"verbose",
73 'V',
75 offsetof(options_t, verbose_level),
76 0,
77 sizeof(unsigned short int),
78 "Increase log verbosity (stackable: -VV, -VVV).",
79 "LOGGING",
80 NULL,
81 false,
82 "ASCII_CHAT_VERBOSE",
83 NULL,
85 false,
86 true,
88 {0},
89 NULL},
90 {"quiet",
91 'q',
93 offsetof(options_t, quiet),
94 &default_quiet_value,
95 sizeof(bool),
96 "Disable console logging (log to file only).",
97 "LOGGING",
98 NULL,
99 false,
100 "ASCII_CHAT_QUIET",
101 NULL,
102 NULL,
103 false,
104 false,
106 {0},
107 NULL},
108 {"grep",
109 '\0',
111 offsetof(options_t, grep_pattern),
112 NULL, // Default is empty string - not meaningful to display in help
113 sizeof(char *),
114 "Filter console logs with perl compatible regular expressions or fixed strings. "
115 "Format 1: /pattern/flags (with flags). Format 2: pattern (plain regex, no flags). "
116 "Flags (format 1 only): i(case-insensitive), m(multiline), s(dotall), x(extended), g(global highlight), "
117 "I(invert match), F(fixed string), A<n>(n lines after), B<n>(n lines before), C<n>(n lines of context). "
118 "Multiple --grep allowed (OR).",
119 "LOGGING",
120 "PATTERN",
121 false,
122 "ASCII_CHAT_GREP",
123 NULL,
124 NULL,
125 false,
126 false,
128 {.examples = (const char *[]){"ERROR", "client\\.c", "network.*failed", NULL}},
129 NULL},
130 {"color-scheme",
131 '\0',
133 offsetof(options_t, color_scheme_name),
135 sizeof(((options_t *)0)->color_scheme_name),
136 "Color scheme for logging output. Built-in schemes: pastel, nord, solarized, dracula, gruvbox, "
137 "monokai, base16-default. All schemes with light variants auto-adapt to terminal background.",
138 "LOGGING",
139 "NAME",
140 false,
141 "ASCII_CHAT_COLOR_SCHEME",
142 NULL,
143 NULL,
144 false,
145 false,
147 {.input_type = OPTION_INPUT_STRING},
148 NULL},
149 {"json",
150 '\0',
152 offsetof(options_t, json),
153 &default_json_value,
154 sizeof(bool),
155 "Enable JSON logging (machine-readable NDJSON format). Disabled by default (text format).",
156 "LOGGING",
157 NULL,
158 false,
159 "ASCII_CHAT_JSON",
160 NULL,
161 NULL,
162 false,
163 false,
165 {0},
166 NULL},
167 {"log-template",
168 '\0',
170 offsetof(options_t, log_template),
171 NULL,
172 sizeof(((options_t *)0)->log_template),
173 "Custom log format string. Format specifiers: %time(fmt) - time with strftime format (see man 3 strftime); "
174 "%level - log level (DEV/DEBUG/INFO/WARN/ERROR/FATAL); %level_aligned - level padded to 5 chars; "
175 "%file - full file path; %file_relative - file path relative to project root; %line - line number; "
176 "%func - function name; %tid - thread ID; %message - log message; "
177 "%color(LEVEL, text) - colorize text using LEVEL's color from current scheme. "
178 "Escape %% for literal %, \\\\ for literal backslash.",
179 "LOGGING",
180 "TEMPLATE",
181 false,
182 "ASCII_CHAT_LOG_TEMPLATE",
183 NULL,
184 NULL,
185 false,
186 false,
188 {.input_type = OPTION_INPUT_STRING},
189 NULL},
190 {"log-format-console",
191 '\0',
193 offsetof(options_t, log_format_console_only),
194 NULL,
195 sizeof(bool),
196 "Apply custom log template (--log-template) only to console output (file logs use default format). See "
197 "--log-template "
198 "for supported format specifiers.",
199 "LOGGING",
200 NULL,
201 false,
202 "ASCII_CHAT_LOG_FORMAT_CONSOLE",
203 NULL,
204 NULL,
205 false,
206 false,
208 {0},
209 NULL},
210
@ OPTION_INPUT_STRING
Free-form text input.
Definition builder.h:180
@ OPTION_INPUT_ENUM
Choose from fixed set of enum values.
Definition builder.h:178
@ OPTION_TYPE_STRING
String value (–name foo)
Definition builder.h:164
@ OPTION_TYPE_CALLBACK
Custom parser function.
Definition builder.h:166
@ OPTION_TYPE_BOOL
Boolean flag (–flag, no value)
Definition builder.h:162
log_level_t
Logging levels enumeration.
Definition types.h:29
#define log_file(...)
File-only logging - writes to log file only, no stderr output.
Definition log/log.h:646
#define OPT_COLOR_SCHEME_NAME_DEFAULT
Default color scheme name (pastel)
@ OPTION_MODE_BINARY
Binary-level options (parsed before mode detection)
@ OPTION_MODE_CLIENT
Client mode (bit 1)
@ OPTION_MODE_DISCOVERY
Discovery mode (bit 4)
@ OPTION_MODE_SERVER
Server mode (bit 0)
@ OPTION_MODE_MIRROR
Mirror mode (bit 2)
@ OPTION_MODE_DISCOVERY_SVC
Discovery server mode (bit 3)
const char * g_log_level_descs[]
Definition metadata.c:31
const int g_log_level_integers[]
Definition metadata.c:30
const char * g_log_level_values[]
Definition metadata.c:23
#define REGISTRY_TERMINATOR()
Initialize a terminator entry (sentinel value for array end) Uses designated initializers to properly...
const void * get_default_log_file(asciichat_mode_t mode)
Get mode-specific default value for –log-file.
bool parse_verbose_flag(const char *arg, void *dest, char **error_msg)
Custom parser for –verbose flag.
Definition parsers.c:972
bool parse_log_file(const char *arg, void *dest, char **error_msg)
Custom parser for log file paths (–log-file, -L)
Definition parsers.c:1127
bool parse_log_level(const char *arg, void *dest, char **error_msg)
Parse log level option.
Definition parsers.c:448
#define bool
Definition stdbool.h:61
Consolidated options structure.