]> git.ipfire.org Git - thirdparty/openssl.git/blob - apps/include/log.h
Added an explicit yield (OP_SLEEP) to QUIC testing for cooperative threading.
[thirdparty/openssl.git] / apps / include / log.h
1 /*
2 * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10 #ifndef OSSL_APPS_LOG_H
11 # define OSSL_APPS_LOG_H
12
13 # include <openssl/bio.h>
14 # if !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_WINDOWS) \
15 && !defined(OPENSSL_NO_SOCK) && !defined(OPENSSL_NO_POSIX_IO)
16 # include <syslog.h>
17 # else
18 # define LOG_EMERG 0
19 # define LOG_ALERT 1
20 # define LOG_CRIT 2
21 # define LOG_ERR 3
22 # define LOG_WARNING 4
23 # define LOG_NOTICE 5
24 # define LOG_INFO 6
25 # define LOG_DEBUG 7
26 # endif
27
28 # undef LOG_TRACE
29 # define LOG_TRACE (LOG_DEBUG + 1)
30
31 int log_set_verbosity(const char *prog, int level);
32 int log_get_verbosity(void);
33
34 /*-
35 * Output a message using the trace API with the given category
36 * if the category is >= 0 and tracing is enabled.
37 * Log the message to syslog if multi-threaded HTTP_DAEMON, else to bio_err
38 * if the verbosity is sufficient for the given level of severity.
39 * Yet cannot do both types of output in strict ANSI mode.
40 * category: trace category as defined in trace.h, or -1
41 * prog: the name of the current app, or NULL
42 * level: the severity of the message, e.g., LOG_ERR
43 * fmt: message format, which should not include a trailing newline
44 * ...: potential extra parameters like with printf()
45 * returns nothing
46 */
47 void trace_log_message(int category,
48 const char *prog, int level, const char *fmt, ...);
49
50 #endif /* OSSL_APPS_LOG_H */