patches and low-level development discussion
 help / color / mirror / code / Atom feed
8a5710529dfc1d16029d909a889653c99fc505ff blob 1160 bytes (raw)

 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2020-2021 Alyssa Ross <hi@alyssa.is>

#define _GNU_SOURCE

#include "log.h"

#include <err.h>
#include <stdbool.h>
#include <stdlib.h>

enum verbosity verbosity = errors;

bool set_verbosity(int opt)
{
	switch (opt) {
	case 'q':
		verbosity = nothing;
		return true;
	case 'Q':
		verbosity = errors;
		return true;
	case 'v':
		verbosity = all;
		return true;
	}

	return false;
}

void veloge(const char *fmt, va_list args)
{
	if (verbosity)
		vwarn(fmt, args);
}

void velog(const char *fmt, va_list args)
{
	if (verbosity)
		vwarnx(fmt, args);
}

void elog(const char *fmt, ...)
{
	va_list ap;
	va_start(ap, fmt);
	velog(fmt, ap);
	va_end(ap);
}

void vilog(const char *fmt, va_list args)
{
	if (verbosity == all)
		vwarnx(fmt, args);
}

void ilog(const char *fmt, ...)
{
	va_list ap;
	va_start(ap, fmt);
	vilog(fmt, ap);
	va_end(ap);
}

void die(int eval, const char *fmt, ...)
{
	va_list ap;
	va_start(ap, fmt);
	velog(fmt, ap);
	va_end(ap);

	exit(eval);
}

void diee(int eval, const char *fmt, ...)
{
	va_list ap;
	va_start(ap, fmt);
	veloge(fmt, ap);
	va_end(ap);

	exit(eval);
}
debug log:

solving 8a57105 ...
found 8a57105 in https://spectrum-os.org/git/ucspi-vsock

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).