OSSP CVS Repository

ossp - History for /ossp-pkg/l2/l2_ut_fmtcb.c
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Directory]  [Show Milestones

DateVersion Description
2005-Oct-03 10:08    1.9    Check-in [5217]: Adjust copyright messages for new year 2005. By rse. (diff)
2005-Jan-24 16:03    1.8    Check-in [4979]: Adjust copyright messages for new year 2005. By rse. (diff)
2003-Jan-06 12:41    1.7    Check-in [3065]: - remove trailing whitespaces - adjust copyright messages - consistently use "OSSP l2" - consistently talk about "Flexible Logging" - use standard OSSP ASCII-art By rse. (diff)
2002-Jul-30 21:08    1.6    Check-in [2437]: polish for release By rse. (diff)
2002-Jul-17 13:19    1.5    Check-in [2295]: added errno formatter from lmtp2nntp By thl. (diff)
2002-Jan-02 18:07    1.4    Check-in [1492]: bump copyright year By rse. (diff)
2001-Sep-07 16:49    1.3    Check-in [889]: better readable text dumping By thl. (diff)
2001-Sep-06 16:37    1.2    Check-in [873]: Replace generic L2_ERROR with more granular L2_ERR_XXX and make sure that we always check with "!= L2_OK". By rse. (diff)
2001-Sep-06 13:56    1.1    Check-in [871]: Add two cool extra formatter functions ;)

l2_util_fmt_string: This can be used like %s, but instead of fetching only a "char *" from the var-args stack, it fetches a "char *" plus a "size_t" and this way allows one to log only a sub-string of a larger string without the need for any temporary buffers, etc.

l2_util_fmt_dump: This can be used as "%{type}X" for dumping arbitrary octets. The parameter "type" can be either "text" (the default if only "%X" is used) for dumping the octets as text but with non-printable characters replaced by "\xXX" constructs; "hex" for dumping the octets in hexadecimal as "XX:XX:XX:XX" or "base64" for dumping the octets Base64 encoded. All three are intended for making it easier to produce reasonable L2_LEVEL_DEBUG messages without having to fiddle around with temporary buffers and having to care with non-printable characters.

For instance, using...

      :
  l2_stream_formatter(st, 'D', l2_util_fmt_dump, NULL);
      :
  l2_stream_vlog(st, L2_LEVEL_DEBUG, "%{text}D %{hex}D %{base64}D\n",
                 "foo", 12345, "foo\1bar", 7, "foo\1bar", 7, "foo\1bar", 7);
      :

...produces "foo\x01bar 66:6f:6f:01:62:61:72 Zm9vAWJhcg==" in the output. By rse.

CVSTrac 2.0.1