-/*
- * If filename == NULL its for syslog logging, otherwise its for file-logging.
- * "unsetuplog" calls with loglevel == NULL.
- * loglevel == NULL means:
- * if logtype == default
- * disable logging
- * else
- * set to default logging
- */
-static void setuplog_internal(const char *loglevel, const char *logtype, const char *filename)
-{
- unsigned int typenum, levelnum;
-
- /* Parse logtype */
- for( typenum=0; typenum < num_logtype_strings; typenum++) {
- if (strcasecmp(logtype, arr_logtype_strings[typenum]) == 0)
- break;
- }
- if (typenum >= num_logtype_strings) {
- return;
- }
-
- /* Parse loglevel */
- if (loglevel == NULL) {
- levelnum = 0;
- } else {
- for(levelnum=1; levelnum < num_loglevel_strings; levelnum++) {
- if (strcasecmp(loglevel, arr_loglevel_strings[levelnum]) == 0)
- break;
- }
- if (levelnum >= num_loglevel_strings) {
- return;
- }
- }
-
- /* is this a syslog setup or a filelog setup ? */
- if (filename == NULL) {
- /* must be syslog */
- syslog_setup(levelnum,
- typenum,
- logoption_ndelay | logoption_pid,
- logfacility_daemon);
- } else {
- /* this must be a filelog */
- log_setup(filename, levelnum, typenum);
- }
-
- return;
-}
-