\section{src/libsphinxbase/util/err.c File Reference}
\label{err_8c}\index{src/libsphinxbase/util/err.\+c@{src/libsphinxbase/util/err.\+c}}


Somewhat antiquated logging and error interface.  


{\ttfamily \#include \char`\"{}config.\+h\char`\"{}}\newline
{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include $<$stdarg.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include \char`\"{}sphinxbase/err.\+h\char`\"{}}\newline
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ err\+\_\+set\+\_\+debug\+\_\+level} (int level)
\begin{DoxyCompactList}\small\item\em Set debugging verbosity level. \end{DoxyCompactList}\item 
int \textbf{ err\+\_\+get\+\_\+debug\+\_\+level} (void)
\begin{DoxyCompactList}\small\item\em Get debugging verbosity level. \end{DoxyCompactList}\item 
F\+I\+LE $\ast$ \textbf{ err\+\_\+get\+\_\+logfp} (void)
\begin{DoxyCompactList}\small\item\em Get the current logging filehandle. \end{DoxyCompactList}\item 
F\+I\+LE $\ast$ \textbf{ err\+\_\+set\+\_\+logfp} (F\+I\+LE $\ast$newfp)
\begin{DoxyCompactList}\small\item\em Direct all logging to a given filehandle. \end{DoxyCompactList}\item 
int \textbf{ err\+\_\+set\+\_\+logfile} (char const $\ast$file)
\begin{DoxyCompactList}\small\item\em Append all log messages to a given file. \end{DoxyCompactList}\item 
\mbox{\label{err_8c_afd2e78db5fc2b29d87b434d0a2d0d07e}} 
void {\bfseries \+\_\+\+E\+\_\+\+\_\+pr\+\_\+info\+\_\+header\+\_\+wofn} (char const $\ast$msg)
\item 
\mbox{\label{err_8c_a5ff468fc371d3fd651257df3819e412a}} 
void {\bfseries \+\_\+\+E\+\_\+\+\_\+pr\+\_\+header} (char const $\ast$f, long ln, char const $\ast$msg)
\item 
\mbox{\label{err_8c_af0a195f2b0f1f9fc2ef7d60593b66faa}} 
void {\bfseries \+\_\+\+E\+\_\+\+\_\+pr\+\_\+info\+\_\+header} (char const $\ast$f, long ln, char const $\ast$msg)
\item 
\mbox{\label{err_8c_a8cdfd1775cf364e5705bb00a262c7865}} 
void {\bfseries \+\_\+\+E\+\_\+\+\_\+pr\+\_\+warn} (char const $\ast$fmt,...)
\item 
\mbox{\label{err_8c_ad90268a25147c7485c0b41b1b12783e4}} 
void {\bfseries \+\_\+\+E\+\_\+\+\_\+pr\+\_\+info} (char const $\ast$fmt,...)
\item 
\mbox{\label{err_8c_ad6271835d1ac95bf7d04cf30a148fb79}} 
void {\bfseries \+\_\+\+E\+\_\+\+\_\+die\+\_\+error} (char const $\ast$fmt,...)
\item 
\mbox{\label{err_8c_add44119b26798320a43e2eaee0f71a15}} 
void {\bfseries \+\_\+\+E\+\_\+\+\_\+fatal\+\_\+sys\+\_\+error} (char const $\ast$fmt,...)
\item 
\mbox{\label{err_8c_a9b5c6b51090d5a2aaedf1ab8e43e8f5c}} 
void {\bfseries \+\_\+\+E\+\_\+\+\_\+sys\+\_\+error} (char const $\ast$fmt,...)
\item 
\mbox{\label{err_8c_a28cf0aaaf44493d5a78dec076d227df4}} 
void {\bfseries \+\_\+\+E\+\_\+\+\_\+abort\+\_\+error} (char const $\ast$fmt,...)
\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{err_8c_ac16dab5cefce6fed135c20d1bae372a5}} 
F\+I\+LE $\ast$ {\bfseries logfp} = N\+U\+LL
\end{DoxyCompactItemize}


\subsection{Detailed Description}
Somewhat antiquated logging and error interface. 



\subsection{Function Documentation}
\mbox{\label{err_8c_a393ad2383651d1fed0223c92208a6631}} 
\index{err.\+c@{err.\+c}!err\+\_\+get\+\_\+debug\+\_\+level@{err\+\_\+get\+\_\+debug\+\_\+level}}
\index{err\+\_\+get\+\_\+debug\+\_\+level@{err\+\_\+get\+\_\+debug\+\_\+level}!err.\+c@{err.\+c}}
\subsubsection{err\+\_\+get\+\_\+debug\+\_\+level()}
{\footnotesize\ttfamily int err\+\_\+get\+\_\+debug\+\_\+level (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Get debugging verbosity level. 

Note that debugging messages are only enabled when compiled with -\/\+D\+D\+E\+B\+UG. 

Definition at line 74 of file err.\+c.

\mbox{\label{err_8c_ae32e95118a1273e1e99584f2c555231a}} 
\index{err.\+c@{err.\+c}!err\+\_\+get\+\_\+logfp@{err\+\_\+get\+\_\+logfp}}
\index{err\+\_\+get\+\_\+logfp@{err\+\_\+get\+\_\+logfp}!err.\+c@{err.\+c}}
\subsubsection{err\+\_\+get\+\_\+logfp()}
{\footnotesize\ttfamily F\+I\+LE$\ast$ err\+\_\+get\+\_\+logfp (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Get the current logging filehandle. 

\begin{DoxyReturn}{Returns}
Current logging filehandle, N\+U\+LL if disabled. 
\end{DoxyReturn}


Definition at line 157 of file err.\+c.



Referenced by err\+\_\+set\+\_\+logfp().

\mbox{\label{err_8c_ac7956e03cd685da5fe6e134c462f73e1}} 
\index{err.\+c@{err.\+c}!err\+\_\+set\+\_\+debug\+\_\+level@{err\+\_\+set\+\_\+debug\+\_\+level}}
\index{err\+\_\+set\+\_\+debug\+\_\+level@{err\+\_\+set\+\_\+debug\+\_\+level}!err.\+c@{err.\+c}}
\subsubsection{err\+\_\+set\+\_\+debug\+\_\+level()}
{\footnotesize\ttfamily int err\+\_\+set\+\_\+debug\+\_\+level (\begin{DoxyParamCaption}\item[{int}]{level }\end{DoxyParamCaption})}



Set debugging verbosity level. 

Note that debugging messages are only enabled when compiled with -\/\+D\+D\+E\+B\+UG.


\begin{DoxyParams}{Parameters}
{\em level} & Verbosity level to set, or 0 to disable debug messages. \\
\hline
\end{DoxyParams}


Definition at line 68 of file err.\+c.

\mbox{\label{err_8c_aaa2d9e5fcb8d7b80d941ba6374762ebe}} 
\index{err.\+c@{err.\+c}!err\+\_\+set\+\_\+logfile@{err\+\_\+set\+\_\+logfile}}
\index{err\+\_\+set\+\_\+logfile@{err\+\_\+set\+\_\+logfile}!err.\+c@{err.\+c}}
\subsubsection{err\+\_\+set\+\_\+logfile()}
{\footnotesize\ttfamily int err\+\_\+set\+\_\+logfile (\begin{DoxyParamCaption}\item[{char const $\ast$}]{file }\end{DoxyParamCaption})}



Append all log messages to a given file. 

Previous logging filehandle is closed (unless it was stdout or stderr).


\begin{DoxyParams}{Parameters}
{\em file} & File to send log messages to, or N\+U\+LL to disable logging. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 for success, $<$0 for failure (e.\+g. if file does not exist) 
\end{DoxyReturn}


Definition at line 190 of file err.\+c.

\mbox{\label{err_8c_a60adc1968822a513d4111963b3eddd79}} 
\index{err.\+c@{err.\+c}!err\+\_\+set\+\_\+logfp@{err\+\_\+set\+\_\+logfp}}
\index{err\+\_\+set\+\_\+logfp@{err\+\_\+set\+\_\+logfp}!err.\+c@{err.\+c}}
\subsubsection{err\+\_\+set\+\_\+logfp()}
{\footnotesize\ttfamily F\+I\+LE$\ast$ err\+\_\+set\+\_\+logfp (\begin{DoxyParamCaption}\item[{F\+I\+LE $\ast$}]{logfp }\end{DoxyParamCaption})}



Direct all logging to a given filehandle. 


\begin{DoxyParams}{Parameters}
{\em logfp} & Filehandle to send log messages to, or N\+U\+LL to disable logging. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Previous logging filehandle, if any. 
\end{DoxyReturn}


Definition at line 179 of file err.\+c.



References err\+\_\+get\+\_\+logfp().

