From 0c576ea19d6d42950615f94feb33df305107a9a6 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Fri, 24 Apr 2015 14:00:50 +0000 Subject: feature 3221 Add Logger class git-svn-id: http://piwigo.org/svn/trunk@31102 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/common.inc.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/common.inc.php') diff --git a/include/common.inc.php b/include/common.inc.php index e3f4a16c7..8fab02ab2 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -104,6 +104,9 @@ if(isset($conf['show_php_errors']) && !empty($conf['show_php_errors'])) include(PHPWG_ROOT_PATH . 'include/constants.php'); include(PHPWG_ROOT_PATH . 'include/functions.inc.php'); +include(PHPWG_ROOT_PATH . 'include/template.class.php'); +include(PHPWG_ROOT_PATH . 'include/cache.class.php'); +include(PHPWG_ROOT_PATH . 'include/Logger.class.php'); $persistent_cache = new PersistentFileCache(); @@ -122,6 +125,17 @@ pwg_db_check_charset(); load_conf_from_db(); +$logger = new Logger(array( + 'directory' => PHPWG_ROOT_PATH . $conf['data_location'] . $conf['log_dir'], + 'severity' => $conf['log_level'], + // we use an hashed filename to prevent direct file access, and we salt with + // the db_password instead of secret_key because the log must be usable in i.php + // (secret_key is in the database) + 'filename' => 'log_' . date('Y-m-d') . '_' . sha1(date('Y-m-d') . $conf['db_password']) . '.txt', + 'globPattern' => 'log_*.txt', + 'archiveDays' => $conf['log_archive_days'], + )); + if (!$conf['check_upgrade_feed']) { if (!isset($conf['piwigo_db_version']) or $conf['piwigo_db_version'] != get_branch_from_version(PHPWG_VERSION)) -- cgit v1.2.3