-
Notifications
You must be signed in to change notification settings - Fork 238
/
File.php
44 lines (37 loc) · 997 Bytes
/
File.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* Lithium: the most rad php framework
*
* @copyright Copyright 2009, Union of RAD (http://union-of-rad.org)
* @license http://opensource.org/licenses/bsd-license.php The BSD License
*/
namespace lithium\util\audit\logger\adapter;
use \SplFileInfo;
use \DirectoryIterator;
class File extends \lithium\core\Object {
/**
* Class constructor
*
* @param array $config
* @return void
*/
public function __construct($config = array()) {
$defaults = array('path' => LITHIUM_APP_PATH . '/resources/tmp/logs');
parent::__construct($config + $defaults);
}
/**
* Appends $data to file $type.
*
* @param string $type
* @param string $message
* @return boolean True on successful write, false otherwise
*/
public function write($type, $message) {
$path = $this->_config['path'];
return function($self, $params, $chain) use (&$path) {
extract($params);
return file_put_contents("$path/$type.log", "{$message}\n", FILE_APPEND);
};
}
}
?>