GRPC C++  1.66.0
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_SUPPORT_LOG_H
20 #define GRPC_SUPPORT_LOG_H
21 
22 #include <stdarg.h>
23 #include <stdlib.h> /* for abort() */
24 
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
38 typedef enum gpr_log_severity {
43 
45 #define GPR_DEBUG __FILE__, __LINE__, GPR_LOG_SEVERITY_DEBUG
46 #define GPR_INFO __FILE__, __LINE__, GPR_LOG_SEVERITY_INFO
47 #define GPR_ERROR __FILE__, __LINE__, GPR_LOG_SEVERITY_ERROR
48 
51 GPRAPI void gpr_log(const char* file, int line, gpr_log_severity severity,
52  const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
53 
55 
56 GPRAPI void gpr_log_message(const char* file, int line,
57  gpr_log_severity severity, const char* message);
58 
60 GPRAPI void gpr_set_log_verbosity(gpr_log_severity deprecated_setting);
61 
63 
68  const char* file;
69  int line;
71  const char* message;
72 };
73 
75 
76 typedef void (*gpr_log_func)(gpr_log_func_args* args);
77 
78 GPRAPI void gpr_set_log_function(gpr_log_func deprecated_setting);
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif /* GRPC_SUPPORT_LOG_H */
GPR_LOG_SEVERITY_DEBUG
@ GPR_LOG_SEVERITY_DEBUG
Definition: log.h:39
GPR_PRINT_FORMAT_CHECK
#define GPR_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS)
Definition: port_platform.h:635
gpr_set_log_verbosity
GPRAPI void gpr_set_log_verbosity(gpr_log_severity deprecated_setting)
Set global log verbosity.
gpr_log_func_args
Log overrides: applications can use this API to intercept logging calls and use their own implementat...
Definition: log.h:67
GPR_LOG_SEVERITY_INFO
@ GPR_LOG_SEVERITY_INFO
Definition: log.h:40
gpr_log_func_args::file
const char * file
Definition: log.h:68
gpr_log_func
void(* gpr_log_func)(gpr_log_func_args *args)
Definition: log.h:76
gpr_log_message
GPRAPI void gpr_log_message(const char *file, int line, gpr_log_severity severity, const char *message)
gpr_set_log_function
GPRAPI void gpr_set_log_function(gpr_log_func deprecated_setting)
GPRAPI
#define GPRAPI
Definition: port_platform.h:721
GPR_LOG_SEVERITY_ERROR
@ GPR_LOG_SEVERITY_ERROR
Definition: log.h:41
gpr_log_verbosity_init
GPRAPI void gpr_log_verbosity_init(void)
gpr_log_func_args::line
int line
Definition: log.h:69
gpr_log_func_args::message
const char * message
Definition: log.h:71
gpr_log_severity
gpr_log_severity
Logging functions in this file are deprecated.
Definition: log.h:38
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
Log a message.
gpr_should_log
GPRAPI void GPRAPI int gpr_should_log(gpr_log_severity severity)
gpr_log_func_args::severity
gpr_log_severity severity
Definition: log.h:70
port_platform.h