From 940a53f12d6aa0984608b9b59d94723658dfd409 Mon Sep 17 00:00:00 2001
From: xue <>
Date: Mon, 3 Apr 2006 13:05:22 +0000
Subject: Added TPropelLogRoute.
---
framework/Util/TPropelLogRoute.php | 95 ++++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
create mode 100644 framework/Util/TPropelLogRoute.php
(limited to 'framework/Util/TPropelLogRoute.php')
diff --git a/framework/Util/TPropelLogRoute.php b/framework/Util/TPropelLogRoute.php
new file mode 100644
index 00000000..2ebbc561
--- /dev/null
+++ b/framework/Util/TPropelLogRoute.php
@@ -0,0 +1,95 @@
+
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package System.Util
+ */
+
+/**
+ * TPropelLogRoute class.
+ *
+ * TPropelLogRoute saves selected log messages into a Propel database.
+ * The name of the Propel database object used to represent each message
+ * is specified by {@link setPropelObjectName PropelObjectName}, which defaults
+ * to 'PradoLog'.
+ *
+ * The schema of the Propel object must be as follows (the table name can be
+ * changed to the value of {@link getPropelObjectName PropelObjectName}.
+ *
+ *
+ *
+ *
+ * @author Jason Ragsdale
+ * @version $Revision: $ $Date: $
+ * @package System.Util
+ * @since 3.0
+ */
+class TPropelLogRoute extends TLogRoute
+{
+ private $_className='PradoLog';
+
+ /**
+ * @return string the name of the Prople object used to save each log message. Defaults to 'PradoLog'.
+ */
+ public function getPropelObjectName()
+ {
+ return $this->_className;
+ }
+
+ /**
+ * @param string the name of the Prople object used to save each log message. The name can be in namespace format.
+ */
+ public function setPropelObjectName($value)
+ {
+ $this->_className=$value;
+ }
+
+ /**
+ * Saves log messages to the Propel database object.
+ *
+ * @param array $logs
+ */
+ protected function processLogs($logs)
+ {
+ foreach($logs as $log)
+ {
+ $pradoLog=Prado::createComponent($this->_className);
+ $pradoLog->setMessage($log[0]);
+ $pradoLog->setLevel($this->getLevelName($log[1]));
+ $pradoLog->setCategory($log[2]);
+ $pradoLog->setTime($log[3]);
+ $pradoLog->save();
+ }
+ }
+}
+?>
\ No newline at end of file
--
cgit v1.2.3