CUBRID Engine  latest
broker_log_util.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
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 
20 /*
21  * broker_log_util.h -
22  */
23 
24 #ifndef _BROKER_LOG_UTIL_H_
25 #define _BROKER_LOG_UTIL_H_
26 
27 #ident "$Id$"
28 
29 #if defined(WINDOWS)
30 #include <windows.h>
31 #else
32 #include <sys/time.h>
33 #endif
34 
35 #include "cas_common.h"
36 #include "log_top_string.h"
37 
38 #define CAS_LOG_BEGIN_WITH_YEAR 1
39 #define CAS_LOG_BEGIN_WITH_MONTH 2
40 
41 #define CAS_LOG_MSG_INDEX 22
42 #define CAS_RUN_NEW_LINE_CHAR 1
43 
44 #define DATE_STR_LEN 21
45 
46 #define GET_CUR_DATE_STR(BUF, LINEBUF) \
47  do { \
48  strncpy(BUF, LINEBUF, DATE_STR_LEN); \
49  BUF[DATE_STR_LEN] = '\0'; \
50  } while (0)
51 
52 extern char *ut_trim (char *);
53 extern void ut_tolower (char *str);
54 extern int ut_get_line (FILE * fp, T_STRING * t_str, char **out_str, int *lineno);
55 extern int is_cas_log (char *str);
56 extern char *get_msg_start_ptr (char *linebuf);
57 
58 extern int str_to_log_date_format (char *str, char *date_format_str);
59 extern char *ut_get_execute_type (char *msg_p, int *prepare_flag, int *execute_flag);
60 extern int ut_check_log_valid_time (const char *log_date, const char *from_date, const char *to_date);
61 extern double ut_diff_time (struct timeval *begin, struct timeval *end);
62 
63 #endif /* _BROKER_LOG_UTIL_H_ */
char * ut_trim(char *)
static void begin(char *test_name)
int ut_get_line(FILE *fp, T_STRING *t_str, char **out_str, int *lineno)
double ut_diff_time(struct timeval *begin, struct timeval *end)
char * get_msg_start_ptr(char *linebuf)
static char to_date[128]
int str_to_log_date_format(char *str, char *date_format_str)
int is_cas_log(char *str)
void ut_tolower(char *str)
char * ut_get_execute_type(char *msg_p, int *prepare_flag, int *execute_flag)
int ut_check_log_valid_time(const char *log_date, const char *from_date, const char *to_date)
static char from_date[128]