-
Notifications
You must be signed in to change notification settings - Fork 3
/
elog.php
47 lines (37 loc) · 1.32 KB
/
elog.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
45
46
47
<?php
function dt_duration_seconds ( $datetime_start, $datetime_end ) {
return ((int)$datetime_end->format('Uv') - (int)$datetime_start->format('Uv')) / 1000;
}
function dt_now () {
return new DateTime( "now" );
}
function elog( $msg ) {
if ( !( strpos($msg, 'queue_content') !== false) ) {
return;
}
$us3home = exec( "ls -d ~us3" );
$elogfile = "$us3home/lims/etc/elog.txt";
$msg = "[" . date('m/d/Y H:i:s', time()) . "] [" . $_SERVER['REMOTE_ADDR'] . "] $msg";
error_log( "$msg\n", 3, $elogfile );
}
function elogo( $msg, $obj ) {
elog( $msg . "\n" . json_encode( $obj, JSON_PRETTY_PRINT ) . "\n" );
}
function elogr( $msg ) {
elog( $msg . "\nRequest:\n" . json_encode( $_REQUEST, JSON_PRETTY_PRINT ) . "\n" );
}
function elogp( $msg ) {
elog( $msg . "\nPost:\n" . json_encode( $_POST, JSON_PRETTY_PRINT ) . "\n" );
}
function elogrp( $msg ) {
elogr( $msg . "\nPost:\n" . json_encode( $_POST, JSON_PRETTY_PRINT ) . "\n" );
}
function elogs( $msg ) {
elog( $msg . "\nSession:\n" . json_encode( $_SESSION, JSON_PRETTY_PRINT ) . "\n" );
}
function elogrs( $msg ) {
elogr( $msg . "\nSession:\n" . json_encode( $_SESSION, JSON_PRETTY_PRINT ) . "\n" );
}
function elogrsp( $msg ) {
elogrp( $msg . "\nSession:\n" . json_encode( $_SESSION, JSON_PRETTY_PRINT ) . "\n" );
}