summaryrefslogtreecommitdiffstats
path: root/3rdparty/fguillot/picofeed/lib/PicoFeed/Logging/Logging.php
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-11-05 11:30:27 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2014-11-05 11:30:38 +0100
commit95530f62513a82c385d9378b4a59da57d74092d9 (patch)
treea4d17994548999b42e99371f381da8c256ee39bf /3rdparty/fguillot/picofeed/lib/PicoFeed/Logging/Logging.php
parent57163ad25a7dc63abd8aff8663c185ddad398466 (diff)
update picofeed, add max size setting, fix #642
Diffstat (limited to '3rdparty/fguillot/picofeed/lib/PicoFeed/Logging/Logging.php')
-rw-r--r--3rdparty/fguillot/picofeed/lib/PicoFeed/Logging/Logging.php95
1 files changed, 95 insertions, 0 deletions
diff --git a/3rdparty/fguillot/picofeed/lib/PicoFeed/Logging/Logging.php b/3rdparty/fguillot/picofeed/lib/PicoFeed/Logging/Logging.php
new file mode 100644
index 000000000..bc465ce7d
--- /dev/null
+++ b/3rdparty/fguillot/picofeed/lib/PicoFeed/Logging/Logging.php
@@ -0,0 +1,95 @@
+<?php
+
+namespace PicoFeed\Logging;
+
+use DateTime;
+use DateTimeZone;
+
+/**
+ * Logging class
+ *
+ * @author Frederic Guillot
+ * @package Logging
+ */
+class Logging
+{
+ /**
+ * List of messages
+ *
+ * @static
+ * @access private
+ * @var array
+ */
+ private static $messages = array();
+
+ /**
+ * Default timezone
+ *
+ * @static
+ * @access private
+ * @var string
+ */
+ private static $timezone = 'UTC';
+
+ /**
+ * Add a new message
+ *
+ * @static
+ * @access public
+ * @param string $message Message
+ */
+ public static function setMessage($message)
+ {
+ $date = new DateTime('now', new DateTimeZone(self::$timezone));
+
+ self::$messages[] = '['.$date->format('Y-m-d H:i:s').'] '.$message;
+ }
+
+ /**
+ * Get all logged messages
+ *
+ * @static
+ * @access public
+ * @return array
+ */
+ public static function getMessages()
+ {
+ return self::$messages;
+ }
+
+ /**
+ * Remove all logged messages
+ *
+ * @static
+ * @access public
+ */
+ public static function deleteMessages()
+ {
+ self::$messages = array();
+ }
+
+ /**
+ * Set a different timezone
+ *
+ * @static
+ * @see http://php.net/manual/en/timezones.php
+ * @access public
+ * @param string $timezone Timezone
+ */
+ public static function setTimeZone($timezone)
+ {
+ self::$timezone = $timezone ?: self::$timezone;
+ }
+
+ /**
+ * Get all messages serialized into a string
+ *
+ * @static
+ * @access public
+ * @return string
+ */
+ public static function toString()
+ {
+ return implode(PHP_EOL, self::$messages).PHP_EOL;
+ }
+}