• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

LogUtils.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 #ifndef LOG_UTILS_H
00024 #define LOG_UTILS_H
00025 
00026 #include "time.h"
00027 
00028 #include "libts.h"
00029 #include "Arena.h"
00030 
00031 namespace LogUtils
00032 {
00033   enum AlarmType
00034   {
00035     LOG_ALARM_ERROR = 0,
00036     LOG_ALARM_WARNING,
00037     LOG_ALARM_N_TYPES
00038   };
00039 
00040   static inline long timestamp() { return (long)time(0); }
00041 
00042   int timestamp_to_str(long timestamp, char *buf, int size);
00043   char *timestamp_to_netscape_str(long timestamp);
00044   char *timestamp_to_date_str(long timestamp);
00045   char *timestamp_to_time_str(long timestamp);
00046   unsigned ip_from_host(char *host);
00047   void manager_alarm(AlarmType alarm_type, const char *msg, ...) TS_PRINTFLIKE(2, 3);
00048   void strip_trailing_newline(char *buf);
00049   char *escapify_url(Arena * arena, char *url, size_t len_in, int *len_out, char *dst=NULL, size_t dst_size=0, const unsigned char *map=NULL);
00050   char *int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_chars, unsigned int req_width=0, char pad_char='0');
00051   void remove_content_type_attributes(char *type_str, int *type_len);
00052   int timestamp_to_hex_str(unsigned timestamp, char *str, size_t len, size_t * n_chars = 0);
00053   int seconds_to_next_roll(time_t time_now, int rolling_offset, int rolling_interval);
00054   int file_is_writeable(const char *full_filename,
00055                                off_t * size_bytes = 0,
00056                                bool * has_size_limit = 0, uint64_t * current_size_limit_bytes = 0);
00057 
00058 };
00059 #endif

Generated by  doxygen 1.7.1