浏览代码

begin logs

develop
Robin Thoni 8 年前
父节点
当前提交
4782a892a3
共有 2 个文件被更改,包括 11 次插入0 次删除
  1. 10
    0
      src/Utils/Business/LuLog.php
  2. 1
    0
      src/Utils/Controller/LuticateApplication.php

+ 10
- 0
src/Utils/Business/LuLog.php 查看文件

@@ -4,7 +4,17 @@ namespace Luticate\Utils\Business;
4 4
 
5 5
 class LuLog {
6 6
 
7
+    /**
8
+     * @var $_logFilePath string
9
+     */
10
+    private static $_logFilePath;
11
+
12
+    public static function setLogFilePath($logFilePath) {
13
+        self::$_logFilePath = $logFilePath;
14
+    }
15
+
7 16
     public static function log($data)
8 17
     {
18
+        file_put_contents(self::$_logFilePath, $data, FILE_APPEND);
9 19
     }
10 20
 }

+ 1
- 0
src/Utils/Controller/LuticateApplication.php 查看文件

@@ -39,6 +39,7 @@ class LuticateApplication implements MessageComponentInterface
39 39
         $this->_config = $configuration;
40 40
         $this->_clients = new \SplObjectStorage;
41 41
         $this->_router = new LuRoute();
42
+        LuLog::setLogFilePath($this->_config["logs"]);
42 43
         self::$_app = $this;
43 44
     }
44 45
 

正在加载...
取消
保存