forked from raiuli/Web-BRBES
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logWriter.php
36 lines (30 loc) · 819 Bytes
/
logWriter.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
<?php
/*session_start();
*
* write_to_log(__FILE__,__LINE__,'$GLOBALS[numberOfRules]',$GLOBALS['numberOfRules']);
*
*
* */
//$_SESSION['myLog']='';
function write_to_log($file,$line,$function_name,$variable_name,$value){
$dump='';
if($_SESSION["debug_enable_for_me"]==true){
$dump .='['.date("Y-m-d h:i:sa").']';
$dump .='['.basename($file).']';
$dump .='['.$line.']';
$dump .='['.$function_name.']';
$dump .='['.$variable_name.']';
$myfile = fopen("log/X8.txt", "a") or die("Unable to open file!");
$dump .= print_r($value, true);
$dump=str_replace("\n", "", $dump);
$dump .=PHP_EOL;
fwrite($myfile,$dump);
fclose($myfile);
if(isset($_SESSION['myLog']) && !empty($_SESSION['myLog'])){
$_SESSION['myLog'].=$dump.'<br>';
}else{
$_SESSION['myLog']=$dump.'<br>';
}
}
}
?>