Completed
Pull Request — master (#5)
by Katsuhiro
02:09
created
classes/log/td.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -90,9 +90,9 @@
 block discarded – undo
90 90
 	   	$message['call']  = $call;
91 91
 
92 92
 		$res = $logger->post('td.'.$database.'.fuel_log',$message);
93
-        if(!$res){
94
-            return false;
95
-        }
93
+		if(!$res){
94
+			return false;
95
+		}
96 96
 
97 97
 		return true;
98 98
 	}
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@  discard block
 block discarded – undo
4 4
 
5 5
 namespace Fluentd\Log;
6 6
 
7
-class Td extends \Fuel\Core\Log{
7
+class Td extends \Fuel\Core\Log {
8 8
 
9
-	public static function _init(){
9
+	public static function _init() {
10 10
 
11 11
 		\Fluent\Autoloader::register();
12 12
 		
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 	public static function write($level, $msg, $method = null)
17 17
 	{
18 18
 		$log_threshold = \Config::get('log_threshold');
19
-		$config = \Config::get('log',array());
19
+		$config = \Config::get('log', array());
20 20
 
21
-		if( isset($config['drivers']['td']['log_threshold']))
21
+		if (isset($config['drivers']['td']['log_threshold']))
22 22
 		{
23 23
 			$log_threshold = $config['drivers']['td']['log_threshold'];
24 24
 		}
@@ -39,58 +39,58 @@  discard block
 block discarded – undo
39 39
 			\Console::log($method.' - '.$msg);
40 40
 		}
41 41
 
42
-		$host     = empty($config['drivers']['td']['host'])     ? null      : $config['drivers']['td']['host'];
43
-		$port     = empty($config['drivers']['td']['port'])     ? null      : $config['drivers']['td']['port'];
44
-		$options  = empty($config['drivers']['td']['options'])  ? array()   : $config['drivers']['td']['options'];
45
-		$packer   = empty($config['drivers']['td']['packer'])   ? null      : $config['drivers']['td']['packer'];
42
+		$host     = empty($config['drivers']['td']['host']) ? null : $config['drivers']['td']['host'];
43
+		$port     = empty($config['drivers']['td']['port']) ? null : $config['drivers']['td']['port'];
44
+		$options  = empty($config['drivers']['td']['options']) ? array() : $config['drivers']['td']['options'];
45
+		$packer   = empty($config['drivers']['td']['packer']) ? null : $config['drivers']['td']['packer'];
46 46
 		$database = empty($config['drivers']['td']['database']) ? 'default' : $config['drivers']['td']['database'];
47 47
 
48
-		$logger = new \Fluent\Logger\FluentLogger($host,$port,$options,$packer);
48
+		$logger = new \Fluent\Logger\FluentLogger($host, $port, $options, $packer);
49 49
 
50
-		$message  = array();
50
+		$message = array();
51 51
 
52 52
 		$call = array();
53 53
 		if ( ! empty($method))
54 54
 		{
55 55
 			$call['method'] = $method;
56
-		}else{
56
+		}else {
57 57
 			$backtrace = debug_backtrace();
58
-			$i=0;
59
-			for(;$i<count($backtrace);$i++){
58
+			$i = 0;
59
+			for (;$i < count($backtrace); $i++) {
60 60
 				$backtrace[$i]['object'] = null;
61 61
 				$break = false;
62 62
 
63
-				if(isset($backtrace[$i]['class'])){
64
-					if(!strstr($backtrace[$i]['class'],__NAMESPACE__)
65
-						and !strstr($backtrace[$i]['class'],'Fuel\Core\Log')) {
63
+				if (isset($backtrace[$i]['class'])) {
64
+					if ( ! strstr($backtrace[$i]['class'], __NAMESPACE__)
65
+						and ! strstr($backtrace[$i]['class'], 'Fuel\Core\Log')) {
66 66
 	
67 67
 						//
68
-						if($level === 'Error'){
69
-							$msg = print_r($backtrace,true);
68
+						if ($level === 'Error') {
69
+							$msg = print_r($backtrace, true);
70 70
 						}
71 71
 						$break = true;
72 72
 					}
73 73
 				}
74 74
 
75
-				if($break){
75
+				if ($break) {
76 76
 					break;
77 77
 				}
78 78
 			}
79
-			if(isset($backtrace[$i])){
80
-				$call['class']    = isset($backtrace[$i]['class'])    ? $backtrace[$i]['class']    : 'null';
81
-				$call['type']     = isset($backtrace[$i]['type'])     ? $backtrace[$i]['type']     : 'null';
79
+			if (isset($backtrace[$i])) {
80
+				$call['class']    = isset($backtrace[$i]['class']) ? $backtrace[$i]['class'] : 'null';
81
+				$call['type']     = isset($backtrace[$i]['type']) ? $backtrace[$i]['type'] : 'null';
82 82
 				$call['function'] = isset($backtrace[$i]['function']) ? $backtrace[$i]['function'] : 'null';
83
-				$call['line']     = isset($backtrace[$i-1]['line'])   ? $backtrace[$i-1]['line']   : 'null';
83
+				$call['line']     = isset($backtrace[$i-1]['line']) ? $backtrace[$i-1]['line'] : 'null';
84 84
 			}
85 85
 		}
86 86
 
87 87
 		$message['level'] = $level;
88 88
 		$message['date']  = date(\Config::get('log_date_format'));
89 89
 		$message['msg']   = $msg;
90
-	   	$message['call']  = $call;
90
+	   	$message['call'] = $call;
91 91
 
92
-		$res = $logger->post('td.'.$database.'.fuel_log',$message);
93
-        if(!$res){
92
+		$res = $logger->post('td.'.$database.'.fuel_log', $message);
93
+        if ( ! $res) {
94 94
             return false;
95 95
         }
96 96
 
Please login to merge, or discard this patch.