|
navit
0.5.3-trunk
|
Go to the source code of this file.
Macros | |
| #define | LOG_BUFFER_SIZE 256 |
Enumerations | |
| enum | log_flags { log_flag_replace_buffer =1 , log_flag_force_flush =2 , log_flag_keep_pointer =4 , log_flag_keep_buffer =8 , log_flag_truncate =16 } |
Functions | |
| int | log_get_attr (struct log *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter) |
| Gets an attribute. More... | |
| struct log * | log_new (struct attr *parent, struct attr **attrs) |
| Creates and initializes a new log object. More... | |
| void | log_set_header (struct log *this_, char *data, int len) |
| Sets the header for a log file. More... | |
| void | log_set_trailer (struct log *this_, char *data, int len) |
| Sets the trailer for a log file. More... | |
| void | log_write (struct log *this_, char *data, int len, enum log_flags flags) |
| Writes to a log. More... | |
| void * | log_get_buffer (struct log *this_, int *len) |
| Returns the data buffer of a log object and its length. More... | |
| void | log_printf (struct log *this_, char *fmt,...) |
| Writes a formatted string to a log. More... | |
| void | log_destroy (struct log *this_) |
| Destroys a log object and frees up its memory. More... | |
| #define LOG_BUFFER_SIZE 256 |
Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
| enum log_flags |
| void log_destroy | ( | struct log * | this_ | ) |
Destroys a log object and frees up its memory.
| this_ | The log object. |
References attr_list_free(), callback_destroy(), dbg, event_remove_timeout(), log_close(), log_flush(), lvl_debug, log::timer, and log::timer_callback.
| int log_get_attr | ( | struct log * | this_, |
| enum attr_type | type, | ||
| struct attr * | attr, | ||
| struct attr_iter * | iter | ||
| ) |
Gets an attribute.
| this_ | The log object. |
| attr_type | The attribute type to return |
| attr | Points to a struct attr to store the attribute |
| iter | An attribute iterator |
References attr_generic_get_attr(), and type.
Referenced by navit_add_log(), vehicle_add_log(), and vehicle_log_gpx().
| void* log_get_buffer | ( | struct log * | this_, |
| int * | len | ||
| ) |
Returns the data buffer of a log object and its length.
| this_ | The log object. |
| len | Points to an int which will receive the length of the buffer. This can be NULL, in which case no information on buffer length will be stored. |
References log_data::data, log::data, and log_data::len.
Referenced by vehicle_log_binfile().
Creates and initializes a new log object.
| parent | The parent object. |
| attrs | Points to an array of pointers to attributes for the new log object |
References attr_list_dup(), attr_search(), callback_cast, callback_new_1, data, dbg, event_add_timeout(), expand_filenames(), file_wordexp_destroy(), file_wordexp_get_array(), file_wordexp_get_count(), file_wordexp_new(), log::filename, filename, log::flush_size, log::flush_time, log::lazy, log_func, log_open(), log_set_last_flush(), log_timer(), lvl_debug, log::mkdir, navit_object_ref(), attr::num, log::overwrite, log::timer, log::timer_callback, and attr::u.
| void log_printf | ( | struct log * | this_, |
| char * | fmt, | ||
| ... | |||
| ) |
Writes a formatted string to a log.
This function formats a string in a fashion similar to
and related functions and writes it to a log using
.
| this_ | The log object. |
| fmt | The format string. |
| ... | Additional arguments must be specified for each placeholder in the format string. |
References LOG_BUFFER_SIZE, log_write(), and size.
| void log_set_header | ( | struct log * | this_, |
| char * | data, | ||
| int | len | ||
| ) |
Sets the header for a log file.
This function sets the header, which is to be inserted into any log file before the actual log data.
| this_ | The log object. |
| data | The header data. |
| len | Size of the header data to be copied, in bytes. |
References log_data::data, data, log::header, log_data::len, and log_data::max_len.
Referenced by navit_add_log(), and vehicle_add_log().
| void log_set_trailer | ( | struct log * | this_, |
| char * | data, | ||
| int | len | ||
| ) |
Sets the trailer for a log file.
This function sets the trailer, which is to be added to any log file after the actual log data.
| this_ | The log object. |
| data | The trailer data. |
| len | Size of the trailer data to be copied, in bytes. |
References log_data::data, data, log_data::len, log_data::max_len, and log::trailer.
Referenced by vehicle_add_log().
Writes to a log.
This function appends data to a log. It rotates the log, if needed, before adding the new data. After adding, the log is flushed if the buffer exceeds its maximum size or if the
flag is set.
| this_ | The log object. |
| data | Points to a buffer containing the data to be appended. |
| len | Length of the data to be appended, in bytes. |
| flags | Flags to control behavior of the function: : forces a flush of the log after appending the data {code log_flag_keep_pointer}: ignored |
References log_data::data, log::data, data, dbg, log_data::len, log_change(), log_change_required(), log_flag_force_flush, log_flag_replace_buffer, log_flush(), log_flush_required(), lvl_debug, lvl_info, and log_data::max_len.
Referenced by log_printf(), navit_textfile_debug_log(), navit_textfile_debug_log_at(), vehicle_log_binfile(), vehicle_log_gpx(), vehicle_log_nmea(), and vehicle_log_textfile().