[DEV-258] Add log commands for PHP debugging (#1167)

This commit is contained in:
Maximiliano Redigonda 2022-03-25 19:03:09 -03:00 committed by GitHub
parent 74870c632a
commit c64eb9930b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 0 deletions

View File

@ -25,6 +25,12 @@ test:
log:
@docker attach opensupports-srv || echo "${red}Please execute 'make run' first${reset}"
clear-debug:
@docker exec -it opensupports-srv bash -c "cd /var/www/html && ./run-clear-debug.sh"
debug:
@docker exec -it opensupports-srv bash -c "cd /var/www/html && ./run-debug.sh"
stop:
@docker stop opensupports-db && docker rm opensupports-db || true
@docker stop opensupports-myadmin && docker rm opensupports-myadmin || true

7
server/libs/Logger.php Normal file
View File

@ -0,0 +1,7 @@
<?php
class Logger {
public static function debug($data) {
error_log(print_r($data, true), 3, "/var/tmp/debug.log");
}
}

5
server/run-clear-debug.sh Executable file
View File

@ -0,0 +1,5 @@
cd /var/tmp
if [ -f debug.log ]
then
rm debug.log
fi

5
server/run-debug.sh Executable file
View File

@ -0,0 +1,5 @@
cd /var/tmp
if [ -f debug.log ]
then
cat debug.log
fi