Motr  M0
logger.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2017-2020 Seagate Technology LLC and/or its Affiliates
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  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_M0CRATE_LOGGER_H__
26 #define __MOTR_M0CRATE_LOGGER_H__
27 
28 #include <stdarg.h> /* va_list */
29 #include <stdio.h> /* vfprintf(), stderr */
30 
38  CLL_ERROR = 0,
39  CLL_WARN = 1,
40  CLL_INFO = 2,
41  CLL_TRACE = 3,
42  CLL_DEBUG = 4,
43  CLL_SAME = -1,
44 };
45 void cr_log(enum cr_log_level lev, const char *fmt, ...)
46  __attribute__((format(printf, 2, 3)));
47 void cr_log_ex(enum cr_log_level lev,
48  const char *pre,
49  const char *post,
50  const char *fmt, ...)
51  __attribute__((format(printf, 4, 5)));
52 void cr_vlog(enum cr_log_level lev, const char *fmt, va_list args);
54 
55 #define crlog(level, ...) cr_log_ex(level, LOG_PREFIX, "\n", __VA_ARGS__)
56 
58 #endif /* __MOTR_M0CRATE_LOGGER_H__ */
59 
60 /*
61  * Local variables:
62  * c-indentation-style: "K&R"
63  * c-basic-offset: 8
64  * tab-width: 8
65  * fill-column: 80
66  * scroll-step: 1
67  * End:
68  */
69 /*
70  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
71  */
enum m0_trace_level level
Definition: trace.c:111
cr_log_level
Definition: logger.h:37
enum m0_md_lustre_logrec_type __attribute__
Definition: balloc.c:2745
Definition: ub.c:49
void cr_set_debug_level(enum cr_log_level level)
Definition: logger.c:63
char * fmt(const char *format,...) __attribute__((format(printf
format
Definition: hist.py:128
void void void cr_vlog(enum cr_log_level lev, const char *fmt, va_list args)
Definition: logger.c:48
void void cr_log_ex(enum cr_log_level lev, const char *pre, const char *post, const char *fmt,...) __attribute__((format(printf
void cr_log(enum cr_log_level lev, const char *fmt,...) __attribute__((format(printf