Soletta machine learning
Machine learning for IoT devices
 All Data Structures Files Functions Typedefs Enumerations Enumerator Groups Pages
sml_log.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
38  SML_LOG_LEVEL_INFO = 1 << 1,
43 };
57 typedef void (*sml_log_handler_cb)(enum sml_log_level level, const char *msg, void *data);
58 
74 void sml_log_set_log_handler(enum sml_log_level levels, sml_log_handler_cb cb, void *data);
75 
83 void sml_log_print(enum sml_log_level level, const char *format, ...);
84 
92 #define sml_debug(...) sml_log_print(SML_LOG_LEVEL_DEBUG, __VA_ARGS__)
93 
101 #define sml_info(...) sml_log_print(SML_LOG_LEVEL_INFO, __VA_ARGS__)
102 
110 #define sml_warning(...) sml_log_print(SML_LOG_LEVEL_WARNING, __VA_ARGS__)
111 
119 #define sml_error(...) sml_log_print(SML_LOG_LEVEL_ERROR, __VA_ARGS__)
120 
128 #define sml_critical(...) sml_log_print(SML_LOG_LEVEL_CRITICAL, __VA_ARGS__)
129 
133 #ifdef __cplusplus
134 }
135 #endif
void(* sml_log_handler_cb)(enum sml_log_level level, const char *msg, void *data)
Log handler callback.
Definition: sml_log.h:57
void sml_log_set_log_handler(enum sml_log_level levels, sml_log_handler_cb cb, void *data)
Set a log handler.
Definition: sml_log.h:38
Definition: sml_log.h:41
void sml_log_print(enum sml_log_level level, const char *format,...)
Prints a message with a desired log level.
Definition: sml_log.h:40
Definition: sml_log.h:42
Definition: sml_log.h:39
sml_log_level
Log level types.
Definition: sml_log.h:36
Definition: sml_log.h:37