To facilitate using the {\ttfamily util.\+debuglog()} function that will be available when node v0.\+12 is released now, this is a copy extracted from the source.\hypertarget{md_sfcode_node_modules_debuglog_README_autotoc_md7866}{}\doxysection{require(\textquotesingle{}debuglog\textquotesingle{})}\label{md_sfcode_node_modules_debuglog_README_autotoc_md7866}
Return {\ttfamily util.\+debuglog}, if it exists, otherwise it will return an internal copy of the implementation from node v0.\+11.\hypertarget{md_sfcode_node_modules_debuglog_README_autotoc_md7867}{}\doxysection{debuglog(section)}\label{md_sfcode_node_modules_debuglog_README_autotoc_md7867}

\begin{DoxyItemize}
\item {\ttfamily section} \{String\} The section of the program to be debugged
\item Returns\+: \{Function\} The logging function
\end{DoxyItemize}

This is used to create a function which conditionally writes to stderr based on the existence of a {\ttfamily NODE\+\_\+\+DEBUG} environment variable. If the {\ttfamily section} name appears in that environment variable, then the returned function will be similar to {\ttfamily console.\+error()}. If not, then the returned function is a no-\/op.

For example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{var debuglog = util.debuglog('foo');}
\DoxyCodeLine{}
\DoxyCodeLine{var bar = 123;}
\DoxyCodeLine{debuglog('hello from foo [\%d]', bar); }

\end{DoxyCode}


If this program is run with {\ttfamily NODE\+\_\+\+DEBUG=foo} in the environment, then it will output something like\+: \begin{DoxyVerb}FOO 3245: hello from foo [123]
\end{DoxyVerb}
 where {\ttfamily 3245} is the process id. If it is not run with that environment variable set, then it will not print anything.

You may separate multiple {\ttfamily NODE\+\_\+\+DEBUG} environment variables with a comma. For example, {\ttfamily NODE\+\_\+\+DEBUG=fs,net,tls}. 