|
@@ -24,19 +24,19 @@ class PushLogConfig
|
|
|
|
|
|
private function __construct()
|
|
private function __construct()
|
|
{
|
|
{
|
|
- $this->LogFile = @fopen(Constants::HW_PUSH_LOG_FILE_NAME, 'a+');
|
|
|
|
- if (! is_resource($this->LogFile)) {
|
|
|
|
- throw new Exception(Constants::HW_PUSH_LOG_FILE_NAME . 'invalid file Stream');
|
|
|
|
- }
|
|
|
|
|
|
+// $this->LogFile = @fopen(Constants::HW_PUSH_LOG_FILE_NAME, 'a+');
|
|
|
|
+// if (!is_resource($this->LogFile)) {
|
|
|
|
+// throw new Exception(Constants::HW_PUSH_LOG_FILE_NAME . 'invalid file Stream');
|
|
|
|
+// }
|
|
|
|
|
|
- fwrite($this->LogFile, $this->logBanner);
|
|
|
|
|
|
+// fwrite($this->LogFile, $this->logBanner);
|
|
|
|
|
|
$pushConfig = PushConfig::getSingleInstance();
|
|
$pushConfig = PushConfig::getSingleInstance();
|
|
|
|
|
|
- $this->default_log_level = $pushConfig->HW_DEFAULT_LOG_LEVEL;
|
|
|
|
- if (empty($this->default_log_level)){
|
|
|
|
- $this->default_log_level = Constants::HW_PUSH_LOG_INFO_LEVEL;
|
|
|
|
- }
|
|
|
|
|
|
+// $this->default_log_level = $pushConfig->HW_DEFAULT_LOG_LEVEL;
|
|
|
|
+// if (empty($this->default_log_level)) {
|
|
|
|
+// $this->default_log_level = Constants::HW_PUSH_LOG_INFO_LEVEL;
|
|
|
|
+// }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -45,7 +45,7 @@ class PushLogConfig
|
|
public static function getSingleInstance()
|
|
public static function getSingleInstance()
|
|
{
|
|
{
|
|
static $obj;
|
|
static $obj;
|
|
- if (! isset($obj)) {
|
|
|
|
|
|
+ if (!isset($obj)) {
|
|
$obj = new PushLogConfig();
|
|
$obj = new PushLogConfig();
|
|
}
|
|
}
|
|
return $obj;
|
|
return $obj;
|
|
@@ -56,6 +56,7 @@ class PushLogConfig
|
|
*/
|
|
*/
|
|
public function LogMessage($msg, $logLevel = Constants::HW_PUSH_LOG_INFO_LEVEL, $module = null, $timeZone = 'Asia/shanghai', $timeFormat = "%Y-%m-%d %H:%M:%S")
|
|
public function LogMessage($msg, $logLevel = Constants::HW_PUSH_LOG_INFO_LEVEL, $module = null, $timeZone = 'Asia/shanghai', $timeFormat = "%Y-%m-%d %H:%M:%S")
|
|
{
|
|
{
|
|
|
|
+ return;
|
|
if (empty($logLevel)) {
|
|
if (empty($logLevel)) {
|
|
$logLevel = Constants::HW_PUSH_LOG_INFO_LEVEL;
|
|
$logLevel = Constants::HW_PUSH_LOG_INFO_LEVEL;
|
|
}
|
|
}
|
|
@@ -64,12 +65,12 @@ class PushLogConfig
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
date_default_timezone_set($timeZone);
|
|
date_default_timezone_set($timeZone);
|
|
- $time = strftime($timeFormat, time());
|
|
|
|
- $msg = str_replace("\t", '', $msg);
|
|
|
|
- $msg = str_replace("\n", '', $msg);
|
|
|
|
|
|
+ $time = strftime($timeFormat, time());
|
|
|
|
+ $msg = str_replace("\t", '', $msg);
|
|
|
|
+ $msg = str_replace("\n", '', $msg);
|
|
$strLogLevel = $this->levelToString($logLevel);
|
|
$strLogLevel = $this->levelToString($logLevel);
|
|
if (isset($module)) {
|
|
if (isset($module)) {
|
|
- $module = '[' . str_pad(str_replace(array(
|
|
|
|
|
|
+ $module = '[' . str_pad(str_replace(array(
|
|
"\n",
|
|
"\n",
|
|
"\t"
|
|
"\t"
|
|
), array(
|
|
), array(
|