/*
* Changes :
* $Log$
- * Revision 1.1 2002/06/26 22:45:50 arma
- * Initial revision
+ * Revision 1.2 2002/07/12 18:14:16 montrose
+ * removed loglevel from global namespace. severity level is set using log() with a NULL format argument now. example: log(LOG_ERR,NULL);
+ *
+ * Revision 1.1.1.1 2002/06/26 22:45:50 arma
+ * initial commit: current code
*
* Revision 1.11 2002/06/14 20:44:57 mp292
* *** empty log message ***
#include <errno.h>
#include "log.h"
-void log_internal(int severity, const char *format, va_list ap);
-
/* Outputs a message to stdout */
void log(int severity, const char *format, ...)
{
- extern int loglevel;
+ static int loglevel = LOG_DEBUG;
va_list ap;
- va_start(ap,format);
-
- if (severity <= loglevel)
+ if ( format )
{
- vprintf(format,ap);
- printf("\n");
- }
+
+ va_start(ap,format);
- va_end(ap);
+ if (severity <= loglevel)
+ {
+ vprintf(format,ap);
+ printf("\n");
+ }
+
+ va_end(ap);
+ }
+ else
+ loglevel = severity;
}
/*
* Changes :
* $Log$
+ * Revision 1.3 2002/07/12 18:14:16 montrose
+ * removed loglevel from global namespace. severity level is set using log() with a NULL format argument now. example: log(LOG_ERR,NULL);
+ *
* Revision 1.2 2002/07/02 09:16:16 arma
* httpap now prepends dest_addr and dest_port strings with their length.
*
#include "httpap.h"
#include "http.h"
-int loglevel = LOG_ERR;
struct timeval conn_tout;
struct timeval *conn_toutp = &conn_tout;
int main(int argc, char *argv[])
{
+ int loglevel = LOG_DEBUG;
int retval = 0;
char c; /* command-line option */
print_usage();
return 0;
break;
- case 'l':
+ case 'l':
if (!strcmp(optarg,"emerg"))
loglevel = LOG_EMERG;
else if (!strcmp(optarg,"alert"))
}
}
+ log(loglevel,NULL); /* assign severity level for logger */
+
/* the -f option is mandatory */
if (conf_filename == NULL)
{
/*
* Changes :
* $Log$
- * Revision 1.1 2002/06/26 22:45:50 arma
- * Initial revision
+ * Revision 1.2 2002/07/12 18:14:16 montrose
+ * removed loglevel from global namespace. severity level is set using log() with a NULL format argument now. example: log(LOG_ERR,NULL);
+ *
+ * Revision 1.1.1.1 2002/06/26 22:45:50 arma
+ * initial commit: current code
*
* Revision 1.37 2002/06/14 20:45:56 mp292
* *** empty log message ***
/* global variables */
/* default logging threshold */
-int loglevel = LOG_ERR;
struct timeval conn_tout;
struct timeval *conn_toutp = &conn_tout;
int islocal = 0; /* is the incoming connection local? */
struct rlimit cd_limit; /* resource limit to prevent core dumps */
+
+ log(LOG_ERR,NULL); /* assign severity level for logger */
/* prevent core dump */
retval = getrlimit(RLIMIT_CORE, &cd_limit);
/********* START VARIABLES **********/
static or_options_t options; /* command-line and config-file options */
-int loglevel;
int global_role;
static connection_t *connection_array[MAXCONNECTIONS] =
signal (SIGINT, catch); /* to catch ^c so we can exit cleanly */
if ( getoptions(argc,argv,&options) ) exit(1);
- /* assign global vars from options. maybe get rid of these globals later */
- loglevel = options.loglevel;
- global_role = options.GlobalRole;
+ log(options.loglevel,NULL); /* assign logging severity level from options */
+ global_role = options.GlobalRole; /* assign global_role from options. FIX: remove from global namespace later. */
ERR_load_crypto_strings();
retval = do_main_loop();
#include "or.h"
-int loglevel;
-
int main(int ac, char **av)
{
or_options_t options;
/*
* Changes :
* $Log$
- * Revision 1.1 2002/06/26 22:45:50 arma
- * Initial revision
+ * Revision 1.2 2002/07/12 18:14:17 montrose
+ * removed loglevel from global namespace. severity level is set using log() with a NULL format argument now. example: log(LOG_ERR,NULL);
+ *
+ * Revision 1.1.1.1 2002/06/26 22:45:50 arma
+ * initial commit: current code
*
* Revision 1.32 2002/04/02 14:29:49 badbytes
* Final finishes.
#include "smtpap.h"
#include "io.h"
-int loglevel = LOG_ERR;
struct timeval conn_tout;
struct timeval *conn_toutp = &conn_tout;
int main(int argc, char *argv[])
{
+ int loglevel = LOG_DEBUG;
int retval = 0;
char c; /* command-line option */
struct sigaction sa;
char *errtest = NULL; /* for detecting strtoul() errors */
-
+
/* set default listening port */
p = htons(SMTPAP_LISTEN_PORT);
print_usage();
return 0;
break;
- case 'l':
+ case 'l':
if (!strcmp(optarg,"emerg"))
loglevel = LOG_EMERG;
else if (!strcmp(optarg,"alert"))
abort();
}
}
-
+
+ log(loglevel,NULL); /* assign severity level for logger */
+
/* the -f option is mandatory */
if (conf_filename == NULL)
{