yast2-core
Macros | Functions | Variables
y2changes.cc File Reference
#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 []
 

Macro Definition Documentation

#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"
#define Y2CHANGES_FORMAT   "%s <%s> %s "

Referenced by y2_changesfmt_prefix().

#define Y2CHANGES_MAXNUM   10 /* Maximum logfiles number */
#define Y2CHANGES_MAXSIZE   10* 1024 * 1024 /* Maximal logfile size */
#define Y2CHANGES_ROOT   LOGDIR "/y2changes"
#define Y2CHANGES_SYSLOG   "<%d>%s "

Referenced by y2changes_function().

#define Y2CHANGES_USER   "/.y2changes" /* Relative to $HOME */
#define Y2CHANGES_VAR_NUM   "Y2MAXLOGNUM"
#define Y2CHANGES_VAR_SIZE   "Y2MAXLOGSIZE"

Function Documentation

static int variable_not_used __attribute__ ( (unused)  )
static
static void do_log_yast ( const char *  logmessage)
static
static int dup_stderr ( )
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 __attribute__(), and Y2CHANGES_STDERR.

static FILE* open_logfile ( )
static
string y2_changesfmt_prefix ( logcategory_t  category)
void y2changes_function ( logcategory_t  category,
const char *  format,
  ... 
)
static void y2changes_set_log_filename ( string  fname)
static

Variable Documentation

bool did_set_logname = false
static
const char* log_messages[]
static
Initial value:
= {
"item",
"note",
}

Referenced by y2_changesfmt_prefix().

bool log_to_file = true
static
bool log_to_syslog = false
static
const char* logname
static
int maxlognum
static
off_t maxlogsize
static
FILE* Y2CHANGES_STDERR = stderr
static

Generated on a sunny day for yast2-core by doxygen 1.8.11