-
Notifications
You must be signed in to change notification settings - Fork 0
/
Log_Voipzilla.php
40 lines (34 loc) · 844 Bytes
/
Log_Voipzilla.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
<?php
/**
* Log class to Voipzilla api
*
* @author Rubens Pinheiro
* @version 0.1
* @package Voipzilla-API-for-PHP
*
*/
require_once( dirname(__FILE__) . '/config.php' );
class Log_Voipzilla{
private static $logConf;
/**
* Saves a newline log
*
* @access public
* @param string $log what will be writen
* @return string|NULL what was writed or NULL if wasn't possible open the file
*/
static function save($log){
global $config;
self::$logConf = $config["log"]["structure"];
$file = dirname(__FILE__)."/".self::$logConf["directory"].date(self::$logConf["name-format"]).self::$logConf["extension"];
@$file = fopen($file, "a");
if(!$file){
return NULL;
}
$prefix = date(self::$logConf["log-prefix"]);
$write = $prefix.$log."\n";
fwrite($file, $write);
fclose($file);
return $write;
}
}