|
yast2-core
|
#include <errno.h>#include <fcntl.h>#include <malloc.h>#include <pwd.h>#include <signal.h>#include <stdarg.h>#include <stdio.h>#include <string.h>#include <sys/stat.h>#include <sys/time.h>#include <sys/types.h>#include <unistd.h>#include <limits>#include <list>#include "y2util/y2changes.h"#include "y2util/y2log.h"#include "y2util/stringutil.h"#include "y2util/PathInfo.h"#include <syslog.h>Macros | |
| #define | Y2CHANGES_DATE "%Y-%m-%d %H:%M:%S" /* The date format */ |
| #define | Y2CHANGES_FORMAT "%s <%s> %s " |
| #define | Y2CHANGES_SYSLOG "<%d>%s " |
| #define | Y2CHANGES_MAXSIZE 10* 1024 * 1024 /* Maximal logfile size */ |
| #define | Y2CHANGES_MAXNUM 10 /* Maximum logfiles number */ |
| #define | LOGDIR "/var/log/YaST2" |
| #define | Y2CHANGES_ROOT LOGDIR "/y2changes" |
| #define | Y2CHANGES_USER "/.y2changes" /* Relative to $HOME */ |
| #define | Y2CHANGES_FALLBACK "/y2changes" |
| #define | Y2CHANGES_VAR_SIZE "Y2MAXLOGSIZE" |
| #define | Y2CHANGES_VAR_NUM "Y2MAXLOGNUM" |
| #define | Y2CHANGES_FACILITY "yast2" |
Functions | |
| static void | do_log_yast (const char *logmessage) |
| static int | dup_stderr () |
| static int variable_not_used | __attribute__ ((unused)) |
| static FILE * | open_logfile () |
| string | y2_changesfmt_prefix (logcategory_t category) |
| void | y2changes_function (logcategory_t category, const char *format,...) |
| static void | y2changes_set_log_filename (string fname) |
Variables | |
| static bool | did_set_logname = false |
| static const char * | logname |
| static off_t | maxlogsize |
| static int | maxlognum |
| static bool | log_to_file = true |
| static bool | log_to_syslog = false |
| static FILE * | Y2CHANGES_STDERR = stderr |
| static const char * | log_messages [] |
| #define LOGDIR "/var/log/YaST2" |
| #define Y2CHANGES_DATE "%Y-%m-%d %H:%M:%S" /* The date format */ |
Referenced by y2_changesfmt_prefix().
| #define Y2CHANGES_FACILITY "yast2" |
| #define Y2CHANGES_FALLBACK "/y2changes" |
Referenced by y2changes_set_log_filename().
| #define Y2CHANGES_FORMAT "%s <%s> %s " |
Referenced by y2_changesfmt_prefix().
| #define Y2CHANGES_MAXNUM 10 /* Maximum logfiles number */ |
Referenced by y2changes_set_log_filename().
| #define Y2CHANGES_MAXSIZE 10* 1024 * 1024 /* Maximal logfile size */ |
Referenced by y2changes_set_log_filename().
| #define Y2CHANGES_ROOT LOGDIR "/y2changes" |
Referenced by y2changes_set_log_filename().
| #define Y2CHANGES_SYSLOG "<%d>%s " |
Referenced by y2changes_function().
| #define Y2CHANGES_USER "/.y2changes" /* Relative to $HOME */ |
Referenced by y2changes_set_log_filename().
| #define Y2CHANGES_VAR_NUM "Y2MAXLOGNUM" |
Referenced by y2changes_set_log_filename().
| #define Y2CHANGES_VAR_SIZE "Y2MAXLOGSIZE" |
Referenced by y2changes_set_log_filename().
|
static |
Referenced by inst_start_shell().
|
static |
References did_set_logname, logname, open_logfile(), shift_log_files_if_needed(), y2changes_set_log_filename(), and Y2CHANGES_STDERR.
Referenced by y2changes_function().
|
static |
y2changes must use a private copy of stderr, esp. in case we're always logging to it (option "-l -"). Some classes like liby2(ExternalProgram) redirect stderr in order to redirect an external programs error output. As a side effect Y2CHANGES output done after the redirection would show up in the external programs output file instead of yast2's stderr.
References Y2CHANGES_STDERR.
|
static |
References PathInfo::assert_dir(), Pathname::dirname(), logname, and Y2CHANGES_STDERR.
Referenced by do_log_yast().
| string y2_changesfmt_prefix | ( | logcategory_t | category | ) |
References stringutil::form(), log_messages, Y2CHANGES_DATE, and Y2CHANGES_FORMAT.
Referenced by y2changes_function().
| void y2changes_function | ( | logcategory_t | category, |
| const char * | format, | ||
| ... | |||
| ) |
The universal logger function
References do_log_yast(), log_to_file, log_to_syslog, stringutil::vform(), y2_changesfmt_prefix(), and Y2CHANGES_SYSLOG.
|
static |
Logfile name initialization
References did_set_logname, log_to_file, log_to_syslog, logname, maxlognum, maxlogsize, stringutil::strtonum(), Y2CHANGES_FALLBACK, Y2CHANGES_MAXNUM, Y2CHANGES_MAXSIZE, Y2CHANGES_ROOT, Y2CHANGES_STDERR, Y2CHANGES_USER, Y2CHANGES_VAR_NUM, and Y2CHANGES_VAR_SIZE.
Referenced by do_log_yast().
|
static |
Referenced by do_log_yast(), and y2changes_set_log_filename().
|
static |
Referenced by y2_changesfmt_prefix().
|
static |
Referenced by y2changes_function(), and y2changes_set_log_filename().
|
static |
Referenced by y2changes_function(), and y2changes_set_log_filename().
|
static |
Referenced by do_log_yast(), open_logfile(), and y2changes_set_log_filename().
|
static |
Referenced by y2changes_set_log_filename().
|
static |
Referenced by y2changes_set_log_filename().
|
static |
Referenced by do_log_yast(), dup_stderr(), open_logfile(), and y2changes_set_log_filename().
1.8.6