[Pkg-ocaml-maint-commits] r3272 - in /trunk/projects/approx/trunk:
debian/changelog log.ml
ecc-guest at users.alioth.debian.org
ecc-guest at users.alioth.debian.org
Wed Oct 25 17:09:39 UTC 2006
Author: ecc-guest
Date: Wed Oct 25 17:09:39 2006
New Revision: 3272
URL: http://svn.debian.org/wsvn/?sc=1&rev=3272
Log:
make sure syslog messages are newline-terminated
Modified:
trunk/projects/approx/trunk/debian/changelog
trunk/projects/approx/trunk/log.ml
Modified: trunk/projects/approx/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/projects/approx/trunk/debian/changelog?rev=3272&op=diff
==============================================================================
--- trunk/projects/approx/trunk/debian/changelog (original)
+++ trunk/projects/approx/trunk/debian/changelog Wed Oct 25 17:09:39 2006
@@ -1,11 +1,13 @@
approx (2.8.0) unstable; urgency=low
+ * Make sure syslog messages are newline-terminated for syslog-ng
+ (closes: #394925)
* Handle tabs as well as spaces in control files (closes: #394062)
* Added "max_rate" configuration variable (closes: #392802)
* Improved description in approx man page of how repository mapping works
* Added XS-Vcs-Svn header to debian/control file
- -- Eric Cooper <ecc at cmu.edu> Fri, 20 Oct 2006 13:15:23 -0400
+ -- Eric Cooper <ecc at cmu.edu> Mon, 23 Oct 2006 22:15:34 -0400
approx (2.7.0) unstable; urgency=low
Modified: trunk/projects/approx/trunk/log.ml
URL: http://svn.debian.org/wsvn/trunk/projects/approx/trunk/log.ml?rev=3272&op=diff
==============================================================================
--- trunk/projects/approx/trunk/log.ml (original)
+++ trunk/projects/approx/trunk/log.ml Wed Oct 25 17:09:39 2006
@@ -4,9 +4,18 @@
open Printf
-let printer = ref (fun _ -> prerr_endline)
+let printer = ref (fun _ msg -> prerr_string msg; flush stderr)
-let message level fmt = ksprintf (fun str -> !printer level str) fmt
+let message level =
+ (* ensure message is newline-terminated,
+ otherwise syslog-ng behaves differently than syslog *)
+ let terminate str =
+ let n = String.length str in
+ if n = 0 then "\n"
+ else if str.[n - 1] = '\n' then str
+ else str ^ "\n"
+ in
+ ksprintf (fun str -> !printer level (terminate str))
let error_message fmt = message `LOG_ERR fmt
let info_message fmt = message `LOG_INFO fmt
More information about the Pkg-ocaml-maint-commits
mailing list