client-c  0.7.0
ext_system_logger.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 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 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /*
27  * @brief Write log message in system dependent way.
28  * Write @c log message from buffer with length message_size, possibly using FILE sink.
29  * @param[in] sink FILE of opened stream or NULL if used some other way to print log.
30  * @param[in] buffer Byte buffer with log message.
31  * @param[in] message_size Length of message size.
32  *
33  */
34 void ext_write_log(FILE * sink, const char * buffer, size_t message_size);
35 
36 /*
37  * @brief Return current system time.
38  * Return system current time in seconds since begin of Epoch.
39  *
40  * @return time_t Time in seconds.
41  */
42 //time_t ext_get_systime();
43 
58 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);
59 
68 int ext_snpintf(char * buffer, size_t buffer_size, const char * format, ...);
69 
70 /*
71  * @brief System depended snprintf with va_list implementation.
72  * System depended snprintf with va_list implementation.
73  * @param[in,out] buffer Buffer to store formated message.
74  * @param[in] buffer_size Size of buffer.
75  * @param[in] format Message format.
76  * @param[in] args Other arguments for message as va_list.
77  */
78 int ext_logger_sprintf(char * buffer, size_t buffer_size, const char * format, va_list args);
79 
80 #ifdef __cplusplus
81 } /* extern "C" */
82 #endif
83 
84 #endif /* EXT_SYSTEM_LOGGER_H_ */
85 
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. Snprintf with "..." in arguments.
kaa_error_t
Definition: kaa_error.h:31
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. LOG prefix format example: 1970/01/01 2:30:36 [TRACE] [kaa_bootstr...
void * FILE