Revision: 18521
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18521
Author: johang
Date: 2008-05-08 22:19:39 +0000 (Thu, 08 May 2008)
Log Message:
-----------
forgot to add the new logging class. here it is.
Added Paths:
-----------
trunk/syncml/inc/class.syncml_logger.inc.php
Added: trunk/syncml/inc/class.syncml_logger.inc.php
===================================================================
--- trunk/syncml/inc/class.syncml_logger.inc.php
(rev 0)
+++ trunk/syncml/inc/class.syncml_logger.inc.php 2008-05-08 22:19:39 UTC
(rev 18521)
@@ -0,0 +1,53 @@
+<?php
+ /**
+ * phpGroupWare (http://phpgroupware.org/)
+ * SyncML interface
+ *
+ * @author Johan Gunnarsson <[EMAIL PROTECTED]>
+ * @copyright Copyright (c) 2007 Free Software Foundation, Inc.
+ * @license GNU General Public License 3 or later
+ * @package syncml
+ * @version $Id: class.sodatabase.inc.php 18394 2008-02-02 10:34:41Z
skwashd $
+ */
+
+ /**
+ * Manage logging.
+ */
+ class syncml_logger
+ {
+ private $handle;
+
+ static private $instance;
+
+ function syncml_logger()
+ {
+ $this->handle = fopen(SYNCML_DEBUG_FILE, 'a');
+ $this->log_run = substr(md5(microtime()), 0, 4);
+ }
+
+ static function get_instance()
+ {
+ if(is_null(self::$instance)) {
+ self::$instance = new syncml_logger();
+ }
+
+ return self::$instance;
+ }
+
+ function log_data($message, $data)
+ {
+ if(SYNCML_DEBUG_MODE) {
+ fwrite($this->handle, sprintf("%s, %s, %s,
%s\n",
+ $this->log_run, date('H:i:s'), $message,
+ var_export($data, true)));
+ }
+ }
+
+ function log($message)
+ {
+ if(SYNCML_DEBUG_MODE) {
+ fwrite($this->handle, sprintf("%s, %s, %s\n",
+ $this->log_run, date('H:i:s'),
$message));
+ }
+ }
+ }
_______________________________________________
phpGroupWare-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/phpgroupware-cvs