Kaa client C SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ext_system_logger.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef EXT_SYSTEM_LOGGER_H_
18 #define EXT_SYSTEM_LOGGER_H_
19 
20 #include "kaa_error.h"
21 #include <platform/time.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /*
28  * @brief Write log message in system dependent way.
29  * Write @c log message from buffer with length message_size, possibly using FILE sink.
30  * @param[in] sink FILE of opened stream or NULL if used some other way to print log.
31  * @param[in] buffer Byte buffer with log message.
32  * @param[in] message_size Length of message size.
33  *
34  */
35 void ext_write_log(FILE * sink, const char * buffer, size_t message_size);
36 
37 /*
38  * @brief Return current system time.
39  * Return system current time in seconds since begin of Epoch.
40  *
41  * @return time_t Time in seconds.
42  */
44 
59 int ext_format_sprintf(char * buffer, size_t buffer_size, const char * format, const char * log_level_name, const char * truncated_name, int lineno, kaa_error_t error_code);
60 
69 int ext_snpintf(char * buffer, size_t buffer_size, const char * format, ...);
70 
71 /*
72  * @brief System depended snprintf with va_list implementation.
73  * System depended snprintf with va_list implementation.
74  * @param[in,out] buffer Buffer to store formated message.
75  * @param[in] buffer_size Size of buffer.
76  * @param[in] format Message format.
77  * @param[in] args Other arguments for message as va_list.
78  */
79 int ext_logger_sprintf(char * buffer, size_t buffer_size, const char * format, va_list args);
80 
81 #ifdef __cplusplus
82 } /* extern "C" */
83 #endif
84 
85 #endif /* EXT_SYSTEM_LOGGER_H_ */
86 
int ext_logger_sprintf(char *buffer, size_t buffer_size, const char *format, va_list args)
int ext_snpintf(char *buffer, size_t buffer_size, const char *format,...)
System depended snprintf implementation.
kaa_error_t
Definition: kaa_error.h:31
kaa_time_t ext_get_systime(void)
long kaa_time_t
Definition: time.h:23
Kaa error codes.
void ext_write_log(FILE *sink, const char *buffer, size_t message_size)
int ext_format_sprintf(char *buffer, size_t buffer_size, const char *format, const char *log_level_name, const char *truncated_name, int lineno, kaa_error_t error_code)
Put formated LOG prefix in buffer.