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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>log.message</title><link rel="stylesheet" href="reference.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="../index.html" title="DocBook XSL Stylesheets: ReferenceDocumentation"><link rel="up" href="utility.html" title="Common Utility Template Reference"><link rel="prev" href="utility.html" title="Common Utility Template Reference"><link rel="next" href="template.get.doc.title.html" title="get.doc.title"><link rel="copyright" href="copyright.html" title="License"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">log.message</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="utility.html">Prev</a></td><th width="60%" align="center">Common Utility Template Reference</th><td width="20%" align="right"><a accesskey="n" href="template.get.doc.title.html">Next</a></td></tr></table><hr></div><div class="refentry" title="log.message"><a name="template.log.message"></a><div class="titlepage"></div>
<div class="refnamediv"><h2>log.message</h2><p>
log.message
— Logs/emits formatted notes and warnings
</p></div>
<div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2>
<pre class="synopsis"><xsl:template name="log.message">
<xsl:param name="level"/>
<xsl:param name="source"/>
<xsl:param name="context-desc"/>
<xsl:param name="context-desc-field-length">12</xsl:param>
<xsl:param name="context-desc-padded">
<xsl:if test="not($context-desc = '')">
<xsl:call-template name="pad-string">
<xsl:with-param name="leftRight">right</xsl:with-param>
<xsl:with-param name="padVar" select="substring($context-desc, 1, $context-desc-field-length)"/>
<xsl:with-param name="length" select="$context-desc-field-length"/>
</xsl:call-template>
</xsl:if>
</xsl:param>
<xsl:param name="message"/>
<xsl:param name="message-field-length" select="45"/>
<xsl:param name="message-padded">
<xsl:variable name="spaces-for-blank-level">
<!-- * if the level field is blank, we'll need to pad out -->
<!-- * the message field with spaces to compensate -->
<xsl:choose>
<xsl:when test="$level = ''">
<xsl:value-of select="4 + 2"/>
<!-- * 4 = hard-coded length of comment text ("Note" or "Warn") -->
<!-- * + 2 = length of colon-plus-space separator ": " -->
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="spaces-for-blank-context-desc">
<!-- * if the context-description field is blank, we'll need -->
<!-- * to pad out the message field with spaces to compensate -->
<xsl:choose>
<xsl:when test="$context-desc = ''">
<xsl:value-of select="$context-desc-field-length + 2"/>
<!-- * + 2 = length of colon-plus-space separator ": " -->
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="extra-spaces" select="$spaces-for-blank-level + $spaces-for-blank-context-desc"/>
<xsl:call-template name="pad-string">
<xsl:with-param name="leftRight">right</xsl:with-param>
<xsl:with-param name="padVar" select="substring($message, 1, ($message-field-length + $extra-spaces))"/>
<xsl:with-param name="length" select="$message-field-length + $extra-spaces"/>
</xsl:call-template>
</xsl:param>
...
</xsl:template></pre>
</div>
<div class="refsect1" title="Description"><a name="id1460117"></a><h2>Description</h2>
<p>The <code class="function">log.message</code> template is a utility
template for logging/emitting formatted messages– that is,
notes and warnings, along with a given log “level” and an
identifier for the “source” that the message relates to.</p>
</div><div class="refsect1" title="Parameters"><a name="id1460134"></a><h2>Parameters</h2>
<div class="variablelist"><dl><dt><span class="term">level</span></dt><dd>
<p>Text to log/emit in the message-level field to
indicate the message level
(<code class="literal">Note</code> or
<code class="literal">Warning</code>)</p>
</dd><dt><span class="term">source</span></dt><dd>
<p>Text to log/emit in the source field to identify the
“source” to which the notification/warning relates.
This can be any arbitrary string, but because the
message lacks line and column numbers to identify the
exact part of the source document to which it
relates, the intention is that the value you pass
into the <code class="literal">source</code> parameter should
give the user some way to identify the portion of
their source document on which to take potentially
take action in response to the log message (for
example, to edit, change, or add content).</p>
<p>So the <code class="literal">source</code> value should be,
for example, an ID, book/chapter/article title, title
of some formal object, or even a string giving an
XPath expression.</p>
</dd><dt><span class="term">context-desc</span></dt><dd>
<p>Text to log/emit in the context-description field to
describe the context for the message.</p>
</dd><dt><span class="term">context-desc-field-length</span></dt><dd>
<p>Specifies length of the context-description field
(in characters); default is 12</p>
<p>If the text specified by the
<code class="literal">context-desc</code> parameter is longer
than the number of characters specified in
<code class="literal">context-desc-field-length</code>, it is
truncated to <code class="literal">context-desc-field-length</code>
(12 characters by default).</p>
<p>If the specified text is shorter than
<code class="literal">context-desc-field-length</code>,
it is right-padded out to
<code class="literal">context-desc-field-length</code> (12 by
default).</p>
<p>If no value has been specified for the
<code class="literal">context-desc</code> parameter, the field is
left empty and the text of the log message begins with
the value of the <code class="literal">message</code>
parameter.</p>
</dd><dt><span class="term">message</span></dt><dd>
<p>Text to log/emit in the actual message field</p>
</dd><dt><span class="term">message-field-length</span></dt><dd>
<p>Specifies length of the message
field (in characters); default is 45</p>
</dd></dl></div>
</div><div class="refsect1" title="Returns"><a name="id1460310"></a><h2>Returns</h2>
<p>Outputs a message (generally, to standard error).</p>
</div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="utility.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="utility.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="template.get.doc.title.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Common Utility Template Reference</td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top">get.doc.title</td></tr></table></div></body></html>
|