Completed
Branch master (1e01b0)
by Katsuhiro
02:03
created
classes/log/file.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@  discard block
 block discarded – undo
8 8
 	public static function write($level, $msg, $method = null)
9 9
 	{
10 10
 		$log_threshold = \Config::get('log_threshold');
11
-		$config = \Config::get('log',array());
11
+		$config = \Config::get('log', array());
12 12
 
13
-		if( isset($config['drivers']['file']['log_threshold']))
13
+		if (isset($config['drivers']['file']['log_threshold']))
14 14
 		{
15 15
 			$log_threshold = $config['drivers']['file']['log_threshold'];
16 16
 		}
@@ -59,40 +59,40 @@  discard block
 block discarded – undo
59 59
 		if ( ! empty($method))
60 60
 		{
61 61
 			$call .= $method;
62
-		}else{
62
+		}else {
63 63
 			$backtrace = debug_backtrace();
64
-			$i=0;
65
-			for(;$i<count($backtrace);$i++){
64
+			$i = 0;
65
+			for (;$i < count($backtrace); $i++) {
66 66
 				$backtrace[$i]['object'] = null;
67 67
 				$break = false;
68 68
 
69
-				if(isset($backtrace[$i]['class'])){
70
-					if(!strstr($backtrace[$i]['class'],__NAMESPACE__)
71
-						and !strstr($backtrace[$i]['class'],'Fuel\Core\Log')) {
69
+				if (isset($backtrace[$i]['class'])) {
70
+					if ( ! strstr($backtrace[$i]['class'], __NAMESPACE__)
71
+						and ! strstr($backtrace[$i]['class'], 'Fuel\Core\Log')) {
72 72
 	
73 73
 						//
74
-						if($level === 'Error'){
74
+						if ($level === 'Error') {
75 75
 							if ($level == 'Error') var_dump($backtrace);
76 76
 						}
77 77
 						$break = true;
78 78
 					}
79 79
 				}
80 80
 
81
-				if($break){
81
+				if ($break) {
82 82
 					break;
83 83
 				}
84 84
 			}
85
-			if(isset($backtrace[$i])){
86
-				$call .= isset($backtrace[$i]['class'])    ? $backtrace[$i]['class']      : ' - ';
87
-				$call .= isset($backtrace[$i]['type'])     ? $backtrace[$i]['type']       : ' - ';
88
-				$call .= isset($backtrace[$i]['function']) ? $backtrace[$i]['function']   : ' - ';
89
-				$call .= isset($backtrace[$i-1]['line'])   ? ':'.$backtrace[$i-1]['line'] : ' - ';
85
+			if (isset($backtrace[$i])) {
86
+				$call .= isset($backtrace[$i]['class']) ? $backtrace[$i]['class'] : ' - ';
87
+				$call .= isset($backtrace[$i]['type']) ? $backtrace[$i]['type'] : ' - ';
88
+				$call .= isset($backtrace[$i]['function']) ? $backtrace[$i]['function'] : ' - ';
89
+				$call .= isset($backtrace[$i-1]['line']) ? ':'.$backtrace[$i-1]['line'] : ' - ';
90 90
 			}
91 91
 		}
92 92
 
93 93
 		$message .= $level.' '.(($level == 'info') ? ' -' : '-').' ';
94 94
 		$message .= date(\Config::get('log_date_format'));
95
-		$message .= ' - ' . 'ouid=' . parent::$opensocial_user_id;
95
+		$message .= ' - '.'ouid='.parent::$opensocial_user_id;
96 96
 		$message .= ' --> '.(empty($call) ? '' : $call.' - ').$msg.PHP_EOL;
97 97
 
98 98
 		flock($fp, LOCK_EX);
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		if ( ! empty($method))
60 60
 		{
61 61
 			$call .= $method;
62
-		}else{
62
+		} else{
63 63
 			$backtrace = debug_backtrace();
64 64
 			$i=0;
65 65
 			for(;$i<count($backtrace);$i++){
@@ -72,7 +72,9 @@  discard block
 block discarded – undo
72 72
 	
73 73
 						//
74 74
 						if($level === 'Error'){
75
-							if ($level == 'Error') var_dump($backtrace);
75
+							if ($level == 'Error') {
76
+								var_dump($backtrace);
77
+							}
76 78
 						}
77 79
 						$break = true;
78 80
 					}
Please login to merge, or discard this patch.
classes/log/td.php 2 patches
Spacing   +24 added lines, -24 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;
56 56
 			$call['method'] = $method;
57
-		}else{
57
+		}else {
58 58
 			$backtrace = debug_backtrace();
59
-			$i=0;
60
-			for(;$i<count($backtrace);$i++){
59
+			$i = 0;
60
+			for (;$i < count($backtrace); $i++) {
61 61
 				$backtrace[$i]['object'] = null;
62 62
 				$break = false;
63 63
 
64
-				if(isset($backtrace[$i]['class'])){
65
-					if(!strstr($backtrace[$i]['class'],__NAMESPACE__)
66
-						and !strstr($backtrace[$i]['class'],'Fuel\Core\Log')) {
64
+				if (isset($backtrace[$i]['class'])) {
65
+					if ( ! strstr($backtrace[$i]['class'], __NAMESPACE__)
66
+						and ! strstr($backtrace[$i]['class'], 'Fuel\Core\Log')) {
67 67
 	
68 68
 						//
69
-						if($level === 'Error'){
69
+						if ($level === 'Error') {
70 70
 							//if ($level == 'Error') var_dump($backtrace);
71 71
 						}
72 72
 						$break = true;
73 73
 					}
74 74
 				}
75 75
 
76
-				if($break){
76
+				if ($break) {
77 77
 					break;
78 78
 				}
79 79
 			}
80
-			if(isset($backtrace[$i])){
81
-				$call['class']    = isset($backtrace[$i]['class'])    ? $backtrace[$i]['class']    : 'null';
82
-				$call['type']     = isset($backtrace[$i]['type'])     ? $backtrace[$i]['type']     : 'null';
80
+			if (isset($backtrace[$i])) {
81
+				$call['class']    = isset($backtrace[$i]['class']) ? $backtrace[$i]['class'] : 'null';
82
+				$call['type']     = isset($backtrace[$i]['type']) ? $backtrace[$i]['type'] : 'null';
83 83
 				$call['function'] = isset($backtrace[$i]['function']) ? $backtrace[$i]['function'] : 'null';
84
-				$call['line']     = isset($backtrace[$i-1]['line'])   ? $backtrace[$i-1]['line']   : 'null';
84
+				$call['line']     = isset($backtrace[$i-1]['line']) ? $backtrace[$i-1]['line'] : 'null';
85 85
 			}
86 86
 		}
87 87
 
88 88
 		$message['level'] = $level;
89 89
 		$message['date']  = date(\Config::get('log_date_format'));
90 90
 		$message['msg']   = $msg;
91
-	   	$message['call']  = $call;
91
+	   	$message['call'] = $call;
92 92
 
93
-		$res = $logger->post('td.'.$database.'.fuel_log',$message);
93
+		$res = $logger->post('td.'.$database.'.fuel_log', $message);
94 94
 
95 95
 		return true;
96 96
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 		{
55 55
 			//$call .= $method;
56 56
 			$call['method'] = $method;
57
-		}else{
57
+		} else{
58 58
 			$backtrace = debug_backtrace();
59 59
 			$i=0;
60 60
 			for(;$i<count($backtrace);$i++){
Please login to merge, or discard this patch.
classes/log/copy.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,18 +2,18 @@
 block discarded – undo
2 2
 
3 3
 namespace Fluentd\Log;
4 4
 
5
-class Copy extends \Fluentd\Log{
5
+class Copy extends \Fluentd\Log {
6 6
 
7
-	public static function write($level, $msg, $method = null){
7
+	public static function write($level, $msg, $method = null) {
8 8
 		$log_config = \Config::get('log');
9 9
 
10 10
 		$return = false;
11
-		if(array_key_exists('copy',$log_config['drivers'])){
12
-			foreach( $log_config['drivers']['copy'] as $driver){
13
-				$class = __NAMESPACE__ .'\\'. ucfirst($driver);
11
+		if (array_key_exists('copy', $log_config['drivers'])) {
12
+			foreach ($log_config['drivers']['copy'] as $driver) {
13
+				$class = __NAMESPACE__.'\\'.ucfirst($driver);
14 14
 
15
-				try{
16
-					$return = $class::write($level,$msg,$method);
15
+				try {
16
+					$return = $class::write($level, $msg, $method);
17 17
 				} catch (FuelException $e) {
18 18
 					//
19 19
 				}
Please login to merge, or discard this patch.
classes/log.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 		self::$opensocial_user_id = $opensocial_user_id;
11 11
 	}
12 12
 
13
-	public static function _init(){
13
+	public static function _init() {
14 14
 		\Config::load('log', true);
15 15
 	}
16 16
 
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 		return static::write(\Fuel::L_INFO, $msg, $method);
20 20
 	}
21 21
 
22
-	public static function write($level, $msg, $method = null){
22
+	public static function write($level, $msg, $method = null) {
23 23
 
24 24
 		\Config::load('log', true);
25
-		$config = \Config::get('log',array());
25
+		$config = \Config::get('log', array());
26 26
 		
27 27
 		if (empty($config['driver']))
28 28
 		{
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 
32 32
 		$class = 'Fluentd\\Log\\'.ucfirst($config['driver']);
33 33
 		
34
-		try{
35
-			return $class::write($level,$msg,$method);
34
+		try {
35
+			return $class::write($level, $msg, $method);
36 36
 		} catch (FuelException $e) {
37 37
 		}
38 38
 	}
Please login to merge, or discard this patch.
classes/observer/td.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,20 +17,20 @@
 block discarded – undo
17 17
 	{
18 18
 
19 19
 		$save_data = array();
20
-		foreach(array_keys($obj->properties()) as $p){
20
+		foreach (array_keys($obj->properties()) as $p) {
21 21
 			$save_data[$p] = $obj->{$p};
22 22
 		}
23 23
 
24
-		$host     = empty(self::$td_config['host'])     ? null      : self::$td_config['host'];
25
-		$port     = empty(self::$td_config['port'])     ? null      : self::$td_config['port'];
26
-		$options  = empty(self::$td_config['options'])  ? array()   : self::$td_config['options'];
27
-		$packer   = empty(self::$td_config['packer'])   ? null      : self::$td_config['packer'];
24
+		$host     = empty(self::$td_config['host']) ? null : self::$td_config['host'];
25
+		$port     = empty(self::$td_config['port']) ? null : self::$td_config['port'];
26
+		$options  = empty(self::$td_config['options']) ? array() : self::$td_config['options'];
27
+		$packer   = empty(self::$td_config['packer']) ? null : self::$td_config['packer'];
28 28
 		$database = empty(self::$td_config['database']) ? 'default' : self::$td_config['database'];
29 29
 		$table_name = $obj->table();
30 30
 
31 31
 		\Fluent\Autoloader::register();
32
-		$logger = new \Fluent\Logger\FluentLogger($host,$port,$options,$packer);
33
-		$res = $logger->post('td.'.$database.'.'.$table_name,$save_data);
32
+		$logger = new \Fluent\Logger\FluentLogger($host, $port, $options, $packer);
33
+		$res = $logger->post('td.'.$database.'.'.$table_name, $save_data);
34 34
 
35 35
 	}
36 36
 }
Please login to merge, or discard this patch.
config/observer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php 
2
-$observer_conf =  array(
2
+$observer_conf = array(
3 3
 	'td' => array(
4 4
 		'database' => 'default',
5 5
 		//'host' => 'unix:///var/run/td-agent/td-agent.sock',
Please login to merge, or discard this patch.
config/log.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php 
2
-$log_conf =  array(
2
+$log_conf = array(
3 3
 	'driver' => 'file',
4 4
 
5 5
 	'drivers' => array(
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 				'log_threshold'    => Fuel::L_INFO,
8 8
 				'log_path' => DOCROOT.'../logs/',
9 9
 				),
10
-		'copy' => array('file','td'),
10
+		'copy' => array('file', 'td'),
11 11
 		'td' => array(
12 12
 			'log_threshold'    => Fuel::L_INFO,
13 13
 			'database' => 'default',
Please login to merge, or discard this patch.