Annotation of embedaddon/strongswan/src/libcharon/bus/listeners/file_logger.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2012-2015 Tobias Brunner
! 3: * Copyright (C) 2006 Martin Willi
! 4: * HSR Hochschule fuer Technik Rapperswil
! 5: *
! 6: * This program is free software; you can redistribute it and/or modify it
! 7: * under the terms of the GNU General Public License as published by the
! 8: * Free Software Foundation; either version 2 of the License, or (at your
! 9: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
! 10: *
! 11: * This program is distributed in the hope that it will be useful, but
! 12: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
! 13: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
! 14: * for more details.
! 15: */
! 16:
! 17: /**
! 18: * @defgroup file_logger file_logger
! 19: * @{ @ingroup listeners
! 20: */
! 21:
! 22: #ifndef FILE_LOGGER_H_
! 23: #define FILE_LOGGER_H_
! 24:
! 25: #include <bus/listeners/logger.h>
! 26:
! 27: typedef struct file_logger_t file_logger_t;
! 28:
! 29: /**
! 30: * Logger to files which implements listener_t.
! 31: */
! 32: struct file_logger_t {
! 33:
! 34: /**
! 35: * Implements the logger_t interface.
! 36: */
! 37: logger_t logger;
! 38:
! 39: /**
! 40: * Set the loglevel for a debug group.
! 41: *
! 42: * @param group debug group to set
! 43: * @param level max level to log (0..4)
! 44: */
! 45: void (*set_level) (file_logger_t *this, debug_t group, level_t level);
! 46:
! 47: /**
! 48: * Set options used by this logger
! 49: *
! 50: * @param time_format format of timestamp prefix, as in strftime(), cloned
! 51: * @param add_ms TRUE to add the number of milliseconds within the
! 52: * current second after the timestamp
! 53: * @param ike_name TRUE to prefix the name of the IKE_SA
! 54: */
! 55: void (*set_options) (file_logger_t *this, char *time_format, bool add_ms,
! 56: bool ike_name);
! 57:
! 58: /**
! 59: * Open (or reopen) the log file according to the given parameters
! 60: *
! 61: * @param flush_line TRUE to flush buffers after every logged line
! 62: * @param append FALSE to overwrite an existing file, TRUE to append
! 63: */
! 64: void (*open) (file_logger_t *this, bool flush_line, bool append);
! 65:
! 66: /**
! 67: * Destroys a file_logger_t object.
! 68: */
! 69: void (*destroy) (file_logger_t *this);
! 70: };
! 71:
! 72: /**
! 73: * Constructor to create a file_logger_t object.
! 74: *
! 75: * The logger has to be opened via file_logger_t.open() before anything is
! 76: * logged.
! 77: *
! 78: * @param filename name of the log file (stderr and stdout are handled
! 79: * specially), cloned
! 80: * @return file_logger_t object
! 81: */
! 82: file_logger_t *file_logger_create(char *filename);
! 83:
! 84: #endif /** FILE_LOGGER_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>