aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Log.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Minz/Log.php')
-rw-r--r--lib/Minz/Log.php23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/Minz/Log.php b/lib/Minz/Log.php
index 3e6a25f27..3a45082f7 100644
--- a/lib/Minz/Log.php
+++ b/lib/Minz/Log.php
@@ -20,21 +20,24 @@ class Minz_Log {
* @throws Minz_PermissionDeniedException
*/
public static function record ($information, $level, $file_name = null) {
- try {
- $conf = Minz_Configuration::get('system');
- $env = $conf->environment;
- } catch (Minz_ConfigurationException $e) {
- $env = 'production';
+ $env = getenv('FRESHRSS_ENV');
+ if ($env == '') {
+ try {
+ $conf = Minz_Configuration::get('system');
+ $env = $conf->environment;
+ } catch (Minz_ConfigurationException $e) {
+ $env = 'production';
+ }
}
if (! ($env === 'silent'
|| ($env === 'production'
&& ($level >= LOG_NOTICE)))) {
+ $username = Minz_Session::param('currentUser', '');
+ if ($username == '') {
+ $username = '_';
+ }
if ($file_name === null) {
- $username = Minz_Session::param('currentUser', '');
- if ($username == '') {
- $username = '_';
- }
$file_name = join_path(USERS_PATH, $username, 'log.txt');
}
@@ -60,7 +63,7 @@ class Minz_Log {
. ' --- ' . $information . "\n";
if (defined('COPY_LOG_TO_SYSLOG') && COPY_LOG_TO_SYSLOG) {
- syslog($level, '[' . $username . '] ' . $log);
+ syslog($level, '[' . $username . '] ' . trim($log));
}
self::ensureMaxLogSize($file_name);