+/**
+ * Log function for debug messages.
+ * This function is only functional when the program is compiled with debug
+ * code enabled; otherwise it is an empty function which the compiler will
+ * hopefully mangle down to "nothing" (see log.h). Therefore you should use
+ * LogDebug(...) in favor to Log(LOG_DEBUG, ...).
+ * @param Format Format string like printf().
+ * @param ... Further arguments.
+ */
+#ifdef DEBUG
+# ifdef PROTOTYPES
+GLOBAL void
+LogDebug( const char *Format, ... )
+# else
+GLOBAL void
+LogDebug( Format, va_alist )
+const char *Format;
+va_dcl
+# endif /* PROTOTYPES */
+{
+ char msg[MAX_LOG_MSG_LEN];
+ va_list ap;
+
+ if (!NGIRCd_Debug) return;
+#ifdef PROTOTYPES
+ va_start( ap, Format );
+#else
+ va_start( ap );
+#endif
+ vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
+ va_end( ap );
+ Log(LOG_DEBUG, "%s", msg);
+}
+#endif /* DEBUG */
+
+
+/**
+ * Logging function of ngIRCd.
+ * This function logs messages to the console and/or syslog, whichever is
+ * suitable for the mode ngIRCd is running in (daemon vs. non-daemon).
+ * If LOG_snotice is set, the log messages goes to all user with the mode +s
+ * set and the local &SERVER channel, too.
+ * Please note: you sould use LogDebug(...) for debug messages!
+ * @param Level syslog level (LOG_xxx)
+ * @param Format Format string like printf().
+ * @param ... Further arguments.
+ */
+#ifdef PROTOTYPES
+GLOBAL void
+Log( int Level, const char *Format, ... )
+#else
+GLOBAL void
+Log( Level, Format, va_alist )
+int Level;
+const char *Format;
+va_dcl
+#endif
+{
+ char msg[MAX_LOG_MSG_LEN];
+ bool snotice;
+ va_list ap;
+
+ assert( Format != NULL );
+
+ if( Level & LOG_snotice )
+ {
+ /* Notice an User mit "s" Mode */
+ snotice = true;
+ Level &= ~LOG_snotice;
+ }
+ else snotice = false;
+
+#ifdef DEBUG
+ if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
+#else
+ if( Level == LOG_DEBUG ) return;
+#endif
+
+#ifdef PROTOTYPES
+ va_start( ap, Format );
+#else
+ va_start( ap );
+#endif
+ vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
+ va_end( ap );
+
+ Log_Message(Level, msg);
+
+ if (Level <= LOG_CRIT) {
+ /* log critical messages to stderr */
+ fprintf(stderr, "%s\n", msg);
+ fflush(stderr);
+ }
+
+ if (snotice) {
+ /* Send NOTICE to all local users with mode +s and to the
+ * local &SERVER channel */
+ Wall_ServerNotice(msg);
+ Channel_LogServer(msg);
+ }
+} /* Log */
+
+
+GLOBAL void
+Log_Init_Resolver( void )