[Swift-commit] r4561 - trunk/docs/userguide

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Fri Jun 3 15:07:13 CDT 2011


Author: wozniak
Date: 2011-06-03 15:07:13 -0500 (Fri, 03 Jun 2011)
New Revision: 4561

Modified:
   trunk/docs/userguide/userguide.txt
Log:
Document tracef()


Modified: trunk/docs/userguide/userguide.txt
===================================================================
--- trunk/docs/userguide/userguide.txt	2011-06-03 19:13:53 UTC (rev 4560)
+++ trunk/docs/userguide/userguide.txt	2011-06-03 20:07:13 UTC (rev 4561)
@@ -1661,7 +1661,6 @@
 used with @arg to pass input parameters to a SwiftScript program as
 integers.
 
-
 Built-in procedure reference
 ----------------------------
 This section details built-in procedures that are available for use in
@@ -1733,6 +1732,38 @@
 log message. The particular output format should not be relied upon.
 (since Swift 0.4)
 
+tracef
+~~~~~~
+
++tracef(_spec_, _variable list_)+ will log its parameters as formatted
+by the formatter _spec_.  _spec_ must be a string. Checks the type of
+the specifiers arguments against the variable list and allows for
+certain escape characters.
+
+Example:
+----
+int i = 3;
+tracef("%s: %i\n", "the value is", i);
+----
+
+Specifiers:
+
++%s+:: Format a string.
++%i+:: Format a number as an integer.
++%f+:: Format a number as a floating point number.
++%q+:: Format an array.
++%M+:: Format a mapped variable's filename.
++%k+:: Wait for the given variable but do not format it.
++%p+:: Format variable according to an internal format.
+
+Escape sequences:
+
++\n+:: Produce a newline.
++\t+:: Produce a tab.
+
+Known issues: :: Swift does not correctly scan certain backslash
+sequences such as +\\+.
+
 writeData
 ~~~~~~~~~
 writeData will write out data structures in the format described for




More information about the Swift-commit mailing list