/usr/share/doc/racket/reference/logging.html is in racket-doc 6.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>15.5 Logging</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="extras.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">►</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x"><span style="font-weight: bold">The Racket Reference</span></a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="model.html" class="tocviewlink" data-pltdoc="x">Language Model</a></td></tr><tr><td align="right">2 </td><td><a href="notation.html" class="tocviewlink" data-pltdoc="x">Notation for Documentation</a></td></tr><tr><td align="right">3 </td><td><a href="syntax.html" class="tocviewlink" data-pltdoc="x">Syntactic Forms</a></td></tr><tr><td align="right">4 </td><td><a href="data.html" class="tocviewlink" data-pltdoc="x">Datatypes</a></td></tr><tr><td align="right">5 </td><td><a href="structures.html" class="tocviewlink" data-pltdoc="x">Structures</a></td></tr><tr><td align="right">6 </td><td><a href="mzlib_class.html" class="tocviewlink" data-pltdoc="x">Classes and Objects</a></td></tr><tr><td align="right">7 </td><td><a href="mzlib_unit.html" class="tocviewlink" data-pltdoc="x">Units</a></td></tr><tr><td align="right">8 </td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">Contracts</a></td></tr><tr><td align="right">9 </td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">Pattern Matching</a></td></tr><tr><td align="right">10 </td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">Control Flow</a></td></tr><tr><td align="right">11 </td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">Concurrency and Parallelism</a></td></tr><tr><td align="right">12 </td><td><a href="Macros.html" class="tocviewlink" data-pltdoc="x">Macros</a></td></tr><tr><td align="right">13 </td><td><a href="input-and-output.html" class="tocviewlink" data-pltdoc="x">Input and Output</a></td></tr><tr><td align="right">14 </td><td><a href="security.html" class="tocviewlink" data-pltdoc="x">Reflection and Security</a></td></tr><tr><td align="right">15 </td><td><a href="os.html" class="tocviewselflink" data-pltdoc="x">Operating System</a></td></tr><tr><td align="right">16 </td><td><a href="memory.html" class="tocviewlink" data-pltdoc="x">Memory Management</a></td></tr><tr><td align="right">17 </td><td><a href="unsafe.html" class="tocviewlink" data-pltdoc="x">Unsafe Operations</a></td></tr><tr><td align="right">18 </td><td><a href="running.html" class="tocviewlink" data-pltdoc="x">Running Racket</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">▼</a></td><td>15 </td><td><a href="os.html" class="tocviewlink" data-pltdoc="x">Operating System</a></td></tr></table><div class="tocviewsublist" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">15.1 </td><td><a href="pathutils.html" class="tocviewlink" data-pltdoc="x">Paths</a></td></tr><tr><td align="right">15.2 </td><td><a href="Filesystem.html" class="tocviewlink" data-pltdoc="x">Filesystem</a></td></tr><tr><td align="right">15.3 </td><td><a href="networking.html" class="tocviewlink" data-pltdoc="x">Networking</a></td></tr><tr><td align="right">15.4 </td><td><a href="subprocess.html" class="tocviewlink" data-pltdoc="x">Processes</a></td></tr><tr><td align="right">15.5 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Logging</a></td></tr><tr><td align="right">15.6 </td><td><a href="time.html" class="tocviewlink" data-pltdoc="x">Time</a></td></tr><tr><td align="right">15.7 </td><td><a href="envvars.html" class="tocviewlink" data-pltdoc="x">Environment Variables</a></td></tr><tr><td align="right">15.8 </td><td><a href="runtime.html" class="tocviewlink" data-pltdoc="x">Environment and Runtime Information</a></td></tr><tr><td align="right">15.9 </td><td><a href="Command-Line_Parsing.html" class="tocviewlink" data-pltdoc="x">Command-<wbr></wbr>Line Parsing</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_2");">►</a></td><td>15.5 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Logging</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_2"><table cellspacing="0" cellpadding="0"><tr><td align="right">15.5.1 </td><td><a href="#%28part._.Creating_.Loggers%29" class="tocviewlink" data-pltdoc="x">Creating Loggers</a></td></tr><tr><td align="right">15.5.2 </td><td><a href="#%28part._.Logging_.Events%29" class="tocviewlink" data-pltdoc="x">Logging Events</a></td></tr><tr><td align="right">15.5.3 </td><td><a href="#%28part._receiving-logged-events%29" class="tocviewlink" data-pltdoc="x">Receiving Logged Events</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">15.5.1<tt> </tt></span><a href="#%28part._.Creating_.Loggers%29" class="tocsubseclink" data-pltdoc="x">Creating Loggers</a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._logger~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">logger?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._make-logger%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>logger</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._logger-name%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">logger-<wbr></wbr>name</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._current-logger%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">current-<wbr></wbr>logger</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._define-logger%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">define-<wbr></wbr>logger</span></span></a></td></tr><tr><td><span class="tocsublinknumber">15.5.2<tt> </tt></span><a href="#%28part._.Logging_.Events%29" class="tocsubseclink" data-pltdoc="x">Logging Events</a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._log-message%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">log-<wbr></wbr>message</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._log-level~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">log-<wbr></wbr>level?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._log-max-level%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">log-<wbr></wbr>max-<wbr></wbr>level</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-fatal%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">log-<wbr></wbr>fatal</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-error%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">log-<wbr></wbr>error</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-warning%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">log-<wbr></wbr>warning</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-info%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">log-<wbr></wbr>info</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-debug%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">log-<wbr></wbr>debug</span></span></a></td></tr><tr><td><span class="tocsublinknumber">15.5.3<tt> </tt></span><a href="#%28part._receiving-logged-events%29" class="tocsubseclink" data-pltdoc="x">Receiving Logged Events</a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._log-receiver~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">log-<wbr></wbr>receiver?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._make-log-receiver%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>log-<wbr></wbr>receiver</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="subprocess.html" title="backward to "15.4 Processes"" data-pltdoc="x">← prev</a> <a href="os.html" title="up to "15 Operating System"" data-pltdoc="x">up</a> <a href="time.html" title="forward to "15.6 Time"" data-pltdoc="x">next →</a></span> </div><h4 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""logging"">15.5<tt> </tt><a name="(part._logging)"></a>Logging</h4><p>A <a name="(tech._logger)"></a><span style="font-style: italic">logger</span> accepts events that contain information to be
logged for interested parties. A <a name="(tech._log._receiver)"></a><span style="font-style: italic">log receiver</span> represents an
interested party that receives logged events asynchronously. Each
event has a level of importance, and a <a href="#%28tech._log._receiver%29" class="techoutside" data-pltdoc="x"><span class="techinside">log receiver</span></a> subscribes to
logging events at a certain level of importance and higher. The
levels, in decreasing order of importance, are <span class="RktVal">'</span><span class="RktVal">fatal</span>,
<span class="RktVal">'</span><span class="RktVal">error</span>, <span class="RktVal">'</span><span class="RktVal">warning</span>, <span class="RktVal">'</span><span class="RktVal">info</span>, and
<span class="RktVal">'</span><span class="RktVal">debug</span>.</p><p>To help organize logged events, <a href="#%28tech._logger%29" class="techoutside" data-pltdoc="x"><span class="techinside">loggers</span></a> can be named and
hierarchical. Every event reported to a logger is also propagated to
its parent (if any), but the event message is prefixed with a name (if
any) that is typically the name of the logger to which is was
originally reported. A logger is not required to have a parent or
name.</p><p>On start-up, Racket creates an initial logger that is used to
record events from the core run-time system. For example, an
<span class="RktVal">'</span><span class="RktVal">debug</span> event is reported for each garbage collection (see
<a href="eval-model.html#%28part._gc-model%29" data-pltdoc="x">Garbage Collection</a>). For this initial logger, two log receivers are
also created: one that writes events to the process’s original error
output port, and one that writes events to the system log. The level
of written events in each case is system-specific, and the default can
be changed through command-line flags (see <a href="running-sa.html#%28part._mz-cmdline%29" data-pltdoc="x">Command Line</a>) or
through environment variables:</p><ul><li><p>If the <a name="(idx._(gentag._337._(lib._scribblings/reference/reference..scrbl)))"></a><span class="stt">PLTSTDERR</span> environment variable is
defined and is not overridden by a command-line flag, it
determines the level of the <a href="#%28tech._log._receiver%29" class="techoutside" data-pltdoc="x"><span class="techinside">log receiver</span></a> that propagates
events to the original error port.</p><p>The environment variable’s value can be a <span class="sroman">‹<span style="font-style: italic">level</span>›</span>:
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">none</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">fatal</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">error</span><span class="hspace"></span></span>,
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">warning</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">info</span><span class="hspace"></span></span>, or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">debug</span><span class="hspace"></span></span>; all
events the corresponding level of higher are printed. After an
initial <span class="sroman">‹<span style="font-style: italic">level</span>›</span>, the value can contain space-separated
specifications of the form
<span class="sroman">‹<span style="font-style: italic">level</span>›</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">@</span><span class="hspace"></span></span><span class="sroman">‹<span style="font-style: italic">name</span>›</span>, which prints events
whose names match <span class="sroman">‹<span style="font-style: italic">name</span>›</span> only at the given
<span class="sroman">‹<span style="font-style: italic">level</span>›</span> or higher (where a <span class="sroman">‹<span style="font-style: italic">name</span>›</span> contains any
character other than a space or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">@</span><span class="hspace"></span></span>). For example,
the value <span class="RktVal">"error debug@GC"</span> prints all events at the
<span class="RktVal">'</span><span class="RktVal">error</span> level and higher, but prints events
named <span class="RktVal">'</span><span class="RktVal">GC</span> at the <span class="RktVal">'</span><span class="RktVal">debug</span> level and
higher (which includes all levels).</p><p>The default is <span class="RktVal">"error"</span>.</p></li><li><p>If the <a name="(idx._(gentag._338._(lib._scribblings/reference/reference..scrbl)))"></a><span class="stt">PLTSYSLOG</span> environment variable is
defined and is not overridden by a command-line flag, it
determines the level of the <a href="#%28tech._log._receiver%29" class="techoutside" data-pltdoc="x"><span class="techinside">log receiver</span></a> that propagates
events to the system log. The possible values are the
same as for <span class="stt">PLTSTDERR</span>.</p><p>The default is <span class="RktVal">"none"</span> for Unix or <span class="RktVal">"error"</span> for
Windows and Mac OS X.</p></li></ul><p>The <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._current-logger%29%29" class="RktValLink" data-pltdoc="x">current-logger</a></span> <a href="eval-model.html#%28tech._parameter%29" class="techoutside" data-pltdoc="x"><span class="techinside">parameter</span></a> determines the
<a name="(tech._current._logger)"></a><span style="font-style: italic">current logger</span> that is used by forms such as
<span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-warning%29%29" class="RktStxLink" data-pltdoc="x">log-warning</a></span>. On start-up, the initial value of this parameter
is the initial logger. The run-time system sometimes uses the current
logger to report events. For example, the bytecode compiler sometimes
reports <span class="RktVal">'</span><span class="RktVal">warning</span> events when it detects an expression that
would produce a run-time error if evaluated.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""Creating_Loggers"">15.5.1<tt> </tt><a name="(part._.Creating_.Loggers)"></a>Creating Loggers</h5><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._logger~3f))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._logger~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">logger?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if <span class="RktVar">v</span> is a <a href="#%28tech._logger%29" class="techoutside" data-pltdoc="x"><span class="techinside">logger</span></a>, <span class="RktVal">#f</span>
otherwise.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._make-logger))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._make-logger%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-logger</a></span></span><span class="hspace"> </span>[<span class="RktVar">name</span><span class="hspace"> </span><span class="RktVar">parent</span><span class="hspace"> </span><span class="RktVar">notify-callback</span>]<span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._logger~3f%29%29" class="RktValLink" data-pltdoc="x">logger?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">name</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">parent</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._logger~3f%29%29" class="RktValLink" data-pltdoc="x">logger?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">notify-callback</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="vectors.html#%28def._%28%28quote._~23~25kernel%29._vector~3f%29%29" class="RktValLink" data-pltdoc="x">vector?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Creates a new <a href="#%28tech._logger%29" class="techoutside" data-pltdoc="x"><span class="techinside">logger</span></a> with an optional name and parent.</div></p><p>If <span class="RktVar">notify-callback</span> is provided, then it is called (under a
<a href="eval-model.html#%28tech._continuation._barrier%29" class="techoutside" data-pltdoc="x"><span class="techinside">continuation barrier</span></a>) whenever an event is logged to the result
<a href="#%28tech._logger%29" class="techoutside" data-pltdoc="x"><span class="techinside">logger</span></a> or one of its descendants, but only if some <a href="#%28tech._log._receiver%29" class="techoutside" data-pltdoc="x"><span class="techinside">log
receiver</span></a> is interested in the event in the same sense as
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-level~3f%29%29" class="RktValLink" data-pltdoc="x">log-level?</a></span>. The event is not propagated to any <a href="#%28tech._log._receiver%29" class="techoutside" data-pltdoc="x"><span class="techinside">log
receivers</span></a> until <span class="RktVar">notify-callback</span> returns.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._logger-name))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._logger-name%29%29" class="RktValDef RktValLink" data-pltdoc="x">logger-name</a></span></span><span class="hspace"> </span><span class="RktVar">logger</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">logger</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._logger~3f%29%29" class="RktValLink" data-pltdoc="x">logger?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Reports <span class="RktVar">logger</span>’s name, if any.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>parameter</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._current-logger))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._current-logger%29%29" class="RktValDef RktValLink" data-pltdoc="x">current-logger</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._logger~3f%29%29" class="RktValLink" data-pltdoc="x">logger?</a></span></p></blockquote></td></tr><tr><td><span class="RktPn">(</span><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._current-logger%29%29" class="RktValDef RktValLink" data-pltdoc="x">current-logger</a></span></span><span class="hspace"> </span><span class="RktVar">logger</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">logger</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._logger~3f%29%29" class="RktValLink" data-pltdoc="x">logger?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="eval-model.html#%28tech._parameter%29" class="techoutside" data-pltdoc="x"><span class="techinside">parameter</span></a> that determines the <a href="#%28tech._current._logger%29" class="techoutside" data-pltdoc="x"><span class="techinside">current logger</span></a>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/private/more-scheme..rkt)._define-logger))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._define-logger%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define-logger</a></span></span><span class="hspace"> </span><span class="RktVar">id</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Defines <span class="RktKw">log-</span><span class="RktVar">id</span><span class="RktKw">-fatal</span>,
<span class="RktKw">log-</span><span class="RktVar">id</span><span class="RktKw">-error</span>,
<span class="RktKw">log-</span><span class="RktVar">id</span><span class="RktKw">-warning</span>,
<span class="RktKw">log-</span><span class="RktVar">id</span><span class="RktKw">-info</span>, and
<span class="RktKw">log-</span><span class="RktVar">id</span><span class="RktKw">-debug</span> as forms
like <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-fatal%29%29" class="RktStxLink" data-pltdoc="x">log-fatal</a></span>, <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-error%29%29" class="RktStxLink" data-pltdoc="x">log-error</a></span>,<span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-warning%29%29" class="RktStxLink" data-pltdoc="x">log-warning</a></span>,
<span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-info%29%29" class="RktStxLink" data-pltdoc="x">log-info</a></span>, and <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-debug%29%29" class="RktStxLink" data-pltdoc="x">log-debug</a></span>. The <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._define-logger%29%29" class="RktStxLink" data-pltdoc="x">define-logger</a></span>
form also defines <span class="RktVar">id</span><span class="RktSym">-logger</span>, which is a logger named
<span class="RktVal">'</span><span class="RktVar">id</span> that is a child of <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._current-logger%29%29" class="RktValLink" data-pltdoc="x">current-logger</a></span><span class="RktPn">)</span>;
the <span class="RktKw">log-</span><span class="RktVar">id</span><span class="RktKw">-fatal</span>,
etc<span class="Sendabbrev">.</span> forms use this new logger. The new logger is
created when <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._define-logger%29%29" class="RktStxLink" data-pltdoc="x">define-logger</a></span> is evaluated.</div></p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""Logging_Events"">15.5.2<tt> </tt><a name="(part._.Logging_.Events)"></a>Logging Events</h5><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._log-message))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-message%29%29" class="RktValDef RktValLink" data-pltdoc="x">log-message</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">logger</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">level</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktVar">name</span>]</td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">message</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">data</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktVar">prefix-message?</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">logger</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._logger~3f%29%29" class="RktValLink" data-pltdoc="x">logger?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">level</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">fatal</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">error</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">warning</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">info</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">debug</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">name</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="inspectors.html#%28def._%28%28quote._~23~25kernel%29._object-name%29%29" class="RktValLink" data-pltdoc="x">object-name</a></span><span class="hspace"> </span><span class="RktVar">logger</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">message</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">data</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">prefix-message?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#t</span></td></tr></table></blockquote></div><div class="SIntrapara">Reports an event to <span class="RktVar">logger</span>, which in turn distributes the
information to any <a href="#%28tech._log._receiver%29" class="techoutside" data-pltdoc="x"><span class="techinside">log receivers</span></a> attached to <span class="RktVar">logger</span> or
its ancestors that are interested in events at <span class="RktVar">level</span> or
higher.</div></p><p><a href="#%28tech._log._receiver%29" class="techoutside" data-pltdoc="x"><span class="techinside">Log receivers</span></a> can filter events based on <span class="RktVar">name</span>. In
addition, if <span class="RktVar">name</span> and <span class="RktVar">prefix-message?</span> are not
<span class="RktVal">#f</span>, then <span class="RktVar">message</span> is prefixed with the name followed
by <span class="RktVal">": "</span> before it is sent to receivers.</p><p class="SHistory">Changed in version 6.0.1.10 of package <span class="stt">base</span>: Added the <span class="RktVar">prefix-message?</span> argument.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._log-level~3f))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-level~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">log-level?</a></span></span><span class="hspace"> </span><span class="RktVar">logger</span><span class="hspace"> </span><span class="RktVar">level</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">logger</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._logger~3f%29%29" class="RktValLink" data-pltdoc="x">logger?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">level</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">fatal</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">error</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">warning</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">info</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">debug</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Reports whether any <a href="#%28tech._log._receiver%29" class="techoutside" data-pltdoc="x"><span class="techinside">log receiver</span></a> attached to <span class="RktVar">logger</span> or
one of its ancestors is interested in <span class="RktVar">level</span> events (or
potentially lower). Use this function to avoid work generating an
event for <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-message%29%29" class="RktValLink" data-pltdoc="x">log-message</a></span> if no receiver is interested in the
information; this shortcut is built into <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-fatal%29%29" class="RktStxLink" data-pltdoc="x">log-fatal</a></span>,
<span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-error%29%29" class="RktStxLink" data-pltdoc="x">log-error</a></span>, <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-warning%29%29" class="RktStxLink" data-pltdoc="x">log-warning</a></span>, <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-info%29%29" class="RktStxLink" data-pltdoc="x">log-info</a></span>,
<span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-debug%29%29" class="RktStxLink" data-pltdoc="x">log-debug</a></span>, and forms bound by <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._define-logger%29%29" class="RktStxLink" data-pltdoc="x">define-logger</a></span>,
however, so it should not be used with those forms.</div></p><p>The result of this function can change if a garbage collection
determines that a log receiver is no longer accessible (and therefore
that any event information it receives will never become accessible).</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._log-max-level))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-max-level%29%29" class="RktValDef RktValLink" data-pltdoc="x">log-max-level</a></span></span><span class="hspace"> </span><span class="RktVar">logger</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">fatal</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">error</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">warning</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">info</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">debug</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">logger</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._logger~3f%29%29" class="RktValLink" data-pltdoc="x">logger?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Similar to <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-level~3f%29%29" class="RktValLink" data-pltdoc="x">log-level?</a></span>, but reports the maximum level of logging for
which <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-level~3f%29%29" class="RktValLink" data-pltdoc="x">log-level?</a></span> on <span class="RktVar">logger</span> returns <span class="RktVal">#t</span>. The
result is <span class="RktVal">#f</span> if <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-level~3f%29%29" class="RktValLink" data-pltdoc="x">log-level?</a></span> with <span class="RktVar">logger</span>
currently returns <span class="RktVal">#f</span> for all levels.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/private/more-scheme..rkt)._log-fatal))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-fatal%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">log-fatal</a></span></span><span class="hspace"> </span><span class="RktVar">string-expr</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-fatal%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">log-fatal</a></span><span class="hspace"> </span><span class="RktVar">format-string-expr</span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/private/more-scheme..rkt)._log-error))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-error%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">log-error</a></span></span><span class="hspace"> </span><span class="RktVar">string-expr</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-error%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">log-error</a></span><span class="hspace"> </span><span class="RktVar">format-string-expr</span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/private/more-scheme..rkt)._log-warning))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-warning%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">log-warning</a></span></span><span class="hspace"> </span><span class="RktVar">string-expr</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-warning%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">log-warning</a></span><span class="hspace"> </span><span class="RktVar">format-string-expr</span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/private/more-scheme..rkt)._log-info))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-info%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">log-info</a></span></span><span class="hspace"> </span><span class="RktVar">string-expr</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-info%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">log-info</a></span><span class="hspace"> </span><span class="RktVar">format-string-expr</span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/private/more-scheme..rkt)._log-debug))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-debug%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">log-debug</a></span></span><span class="hspace"> </span><span class="RktVar">string-expr</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._log-debug%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">log-debug</a></span><span class="hspace"> </span><span class="RktVar">format-string-expr</span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Log an event with the <a href="#%28tech._current._logger%29" class="techoutside" data-pltdoc="x"><span class="techinside">current logger</span></a>, evaluating
<span class="RktVar">string-expr</span> or <span class="RktPn">(</span><span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._format%29%29" class="RktValLink" data-pltdoc="x">format</a></span><span class="stt"> </span><span class="RktVar">format-string-expr</span><span class="stt"> </span><span class="RktVar">v</span><span class="stt"> </span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._......%29%29" class="RktStxLink" data-pltdoc="x">...</a></span><span class="RktPn">)</span>
only if the logger has receivers that are interested in the event. In
addition, the current continuation’s <a href="eval-model.html#%28tech._continuation._mark%29" class="techoutside" data-pltdoc="x"><span class="techinside">continuation marks</span></a> are
sent to the logger with the message string.</div></p><p>These form are convenient for using the current logger, but libraries
should generally use a specifically named logger—<wbr></wbr>typically through
similar convenience forms generated by <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._define-logger%29%29" class="RktStxLink" data-pltdoc="x">define-logger</a></span>.</p><p>For each <span class="RktKw">log-</span><span class="RktVar">level</span>,</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktKw">log-</span><span class="RktVar">level</span><span class="hspace"> </span><span class="RktVar">string-expr</span><span class="RktPn">)</span></p></blockquote><p>is equivalent to</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">l</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._current-logger%29%29" class="RktValLink" data-pltdoc="x">current-logger</a></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="when_unless.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._when%29%29" class="RktStxLink" data-pltdoc="x">when</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-level~3f%29%29" class="RktValLink" data-pltdoc="x">log-level?</a></span><span class="hspace"> </span><span class="RktSym">l</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVar">level</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-message%29%29" class="RktValLink" data-pltdoc="x">log-message</a></span><span class="hspace"> </span><span class="RktSym">l</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVar">level</span><span class="hspace"> </span><span class="RktVar">string-expr</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>while</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktKw">log-</span><span class="RktVar">level</span><span class="hspace"> </span><span class="RktVar">format-string-expr</span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._......%29%29" class="RktStxLink" data-pltdoc="x">...</a></span><span class="RktPn">)</span></p></blockquote><p>is equivalent to</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktKw">log-</span><span class="RktVar">level</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._format%29%29" class="RktValLink" data-pltdoc="x">format</a></span><span class="hspace"> </span><span class="RktVar">format-string-expr</span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._......%29%29" class="RktStxLink" data-pltdoc="x">...</a></span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""receiving-logged-events"">15.5.3<tt> </tt><a name="(part._receiving-logged-events)"></a>Receiving Logged Events</h5><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._log-receiver~3f))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-receiver~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">log-receiver?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if <span class="RktVar">v</span> is a <a href="#%28tech._log._receiver%29" class="techoutside" data-pltdoc="x"><span class="techinside">log receiver</span></a>, <span class="RktVal">#f</span>
otherwise.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._make-log-receiver))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._make-log-receiver%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-log-receiver</a></span></span><span class="hspace"> </span><span class="RktVar">logger</span><span class="hspace"> </span><span class="RktVar">level</span><span class="hspace"> </span>[<span class="RktVar">name</span><span class="hspace"> </span><span class="RktMeta">...</span>]<span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-receiver~3f%29%29" class="RktValLink" data-pltdoc="x">log-receiver?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">logger</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._logger~3f%29%29" class="RktValLink" data-pltdoc="x">logger?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">level</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">none</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">fatal</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">error</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">warning</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">info</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">debug</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">name</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Creates a <a href="#%28tech._log._receiver%29" class="techoutside" data-pltdoc="x"><span class="techinside">log receiver</span></a> to receive events of importance
<span class="RktVar">level</span> and higher as reported to <span class="RktVar">logger</span> and its
descendants, as long as either <span class="RktVar">name</span> is <span class="RktVal">#f</span> or the
event’s name matches <span class="RktVar">name</span>.</div></p><p>A <a href="#%28tech._log._receiver%29" class="techoutside" data-pltdoc="x"><span class="techinside">log receiver</span></a> is a <a href="sync.html#%28tech._synchronizable._event%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronizable event</span></a>. It becomes
<a href="sync.html#%28tech._ready._for._synchronization%29" class="techoutside" data-pltdoc="x"><span class="techinside">ready for synchronization</span></a> when a logging event is
received, so use <span class="RktSym"><a href="sync.html#%28def._%28%28quote._~23~25kernel%29._sync%29%29" class="RktValLink" data-pltdoc="x">sync</a></span> to receive an logged event. The
<a href="#%28tech._log._receiver%29" class="techoutside" data-pltdoc="x"><span class="techinside">log receiver</span></a>’s <a href="sync.html#%28tech._synchronization._result%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronization result</span></a> is an immutable vector containing
four values: the level of the event as a symbol, an immutable string
for the event message, an arbitrary value that was supplied as the
last argument to <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._log-message%29%29" class="RktValLink" data-pltdoc="x">log-message</a></span> when the event was logged, and a
symbol or <span class="RktVal">#f</span> for the event name (where a symbol is usually
the name of the original logger for the event).</p><p>Multiple pairs of <span class="RktVar">level</span> and <span class="RktVar">name</span> can be provided to
indicate different specific <span class="RktVar">level</span>s for different
<span class="RktVar">name</span>s (where <span class="RktVar">name</span> defaults to <span class="RktVal">#f</span> only for
the last given <span class="RktVar">level</span>). A <span class="RktVar">level</span> for a <span class="RktVal">#f</span>
<span class="RktVar">name</span> applies only to events whose names do not match any other
provided <span class="RktVar">name</span>. If the same <span class="RktVar">name</span> is provided multiple
times, the <span class="RktVar">level</span> provided with the last instance in the
argument list takes precedence.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="subprocess.html" title="backward to "15.4 Processes"" data-pltdoc="x">← prev</a> <a href="os.html" title="up to "15 Operating System"" data-pltdoc="x">up</a> <a href="time.html" title="forward to "15.6 Time"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|