include/grpc/impl/codegen/log.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPC_IMPL_CODEGEN_LOG_H
20 #define GRPC_IMPL_CODEGEN_LOG_H
21 
22 // IWYU pragma: private, include <grpc/support/log.h>
23 
25 
26 #include <stdarg.h>
27 #include <stdlib.h> /* for abort() */
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
45 typedef enum gpr_log_severity {
50 
53 
55 #define GPR_DEBUG __FILE__, __LINE__, GPR_LOG_SEVERITY_DEBUG
56 #define GPR_INFO __FILE__, __LINE__, GPR_LOG_SEVERITY_INFO
57 #define GPR_ERROR __FILE__, __LINE__, GPR_LOG_SEVERITY_ERROR
58 
61 GPRAPI void gpr_log(const char* file, int line, gpr_log_severity severity,
62  const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
63 
65 
66 GPRAPI void gpr_log_message(const char* file, int line,
68 
70 GPRAPI void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print);
71 
73 
78  const char* file;
79  int line;
81  const char* message;
82 };
83 
85 
88 
94 #define GPR_ASSERT(x) \
95  do { \
96  if (GPR_UNLIKELY(!(x))) { \
97  gpr_log(GPR_ERROR, "assertion failed: %s", #x); \
98  abort(); \
99  } \
100  } while (0)
101 
102 #ifndef NDEBUG
103 #define GPR_DEBUG_ASSERT(x) GPR_ASSERT(x)
104 #else
105 #define GPR_DEBUG_ASSERT(x)
106 #endif
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif /* GRPC_IMPL_CODEGEN_LOG_H */
http2_test_server.format
format
Definition: http2_test_server.py:118
bloat_diff.severity
def severity
Definition: bloat_diff.py:143
const
#define const
Definition: bloaty/third_party/zlib/zconf.h:230
gpr_log_verbosity_init
GPRAPI void gpr_log_verbosity_init(void)
Definition: log.cc:115
gpr_log_func
void(* gpr_log_func)(gpr_log_func_args *args)
Definition: include/grpc/impl/codegen/log.h:86
gpr_should_log
GPRAPI void GPRAPI int gpr_should_log(gpr_log_severity severity)
Definition: log.cc:67
file
Definition: bloaty/third_party/zlib/examples/gzappend.c:170
GPRAPI
#define GPRAPI
Definition: impl/codegen/port_platform.h:660
GPR_LOG_SEVERITY_DEBUG
@ GPR_LOG_SEVERITY_DEBUG
Definition: include/grpc/impl/codegen/log.h:46
gpr_log_severity_string
const GPRAPI char * gpr_log_severity_string(gpr_log_severity severity)
Definition: log.cc:55
GPR_PRINT_FORMAT_CHECK
#define GPR_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS)
Definition: impl/codegen/port_platform.h:615
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
gen_build_yaml.struct
def struct(**kwargs)
Definition: test/core/end2end/gen_build_yaml.py:30
gpr_log_func_args
Definition: include/grpc/impl/codegen/log.h:77
GPR_LOG_SEVERITY_INFO
@ GPR_LOG_SEVERITY_INFO
Definition: include/grpc/impl/codegen/log.h:47
gpr_log_severity
gpr_log_severity
Definition: include/grpc/impl/codegen/log.h:45
gpr_log_func_args::file
const char * file
Definition: include/grpc/impl/codegen/log.h:78
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
GPR_LOG_SEVERITY_ERROR
@ GPR_LOG_SEVERITY_ERROR
Definition: include/grpc/impl/codegen/log.h:48
func
const EVP_CIPHER *(* func)(void)
Definition: cipher_extra.c:73
gpr_log_func_args::line
int line
Definition: include/grpc/impl/codegen/log.h:79
gpr_log_func_args::message
const char * message
Definition: include/grpc/impl/codegen/log.h:81
port_platform.h
regen-readme.line
line
Definition: regen-readme.py:30
gpr_log_message
GPRAPI void gpr_log_message(const char *file, int line, gpr_log_severity severity, const char *message)
Definition: log.cc:81
gpr_log_func_args::severity
gpr_log_severity severity
Definition: include/grpc/impl/codegen/log.h:80
gpr_set_log_function
GPRAPI void gpr_set_log_function(gpr_log_func func)
Definition: log.cc:143
gpr_set_log_verbosity
GPRAPI void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print)
Definition: log.cc:96


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:29