summary refs log tree commit diff
path: root/log.h
blob: 706d42f217e2104e1475da5937c143003896e64a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2020-2021 Alyssa Ross <hi@alyssa.is>

#include <stdarg.h>

enum verbosity {
	nothing,
	errors,
	all,
};

extern enum verbosity verbosity;

// Functions with an `e' suffix additionally print strerrno(errno).

// If opt is a character that matches a standard UCSPI command line
// verbosity option, sets the verbosity appropriately and returns
// true.  Otherwise, returns false.
_Bool set_verbosity(int opt);

// Log an error message then exit with status eval.
_Noreturn void die(int eval, const char *fmt, ...);
_Noreturn void diee(int eval, const char *fmt, ...);

// Log an error message.
void elog(const char *fmt, ...);
void velog(const char *fmt, va_list args);
void veloge(const char *fmt, va_list args);

// Log an informative message.
void ilog(const char *fmt, ...);
void vilog(const char *fmt, va_list args);