Skip to content

Commit 9fdb271

Browse files
committed
Add logger
1 parent 5072473 commit 9fdb271

File tree

8 files changed

+51
-10
lines changed

8 files changed

+51
-10
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ phpinfo();
150150

151151
### Recommended Package
152152

153+
```shell
154+
docker-compose exec --user=laradock workspace bash
155+
```
156+
157+
```shell
158+
cd app.test
159+
```
160+
153161
- [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv)
154162
Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
155163

app.test/app/ThirdParty/logger.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
<?php
22

3+
/**
4+
* Monolog - Logging for PHP
5+
*
6+
* Monolog sends your logs to files, sockets, inboxes, databases and various web services.
7+
*
8+
* @link https://github.com/Seldaek/monolog
9+
*
10+
* @license MIT License
11+
*/
12+
313
use Monolog\Logger;
414
use Monolog\Handler\StreamHandler;
515

16+
// create a log channel
17+
$log = new Logger('Application');
18+
$log->pushHandler(new StreamHandler(LOG_PATH . '/application.log', Logger::DEBUG));
19+
620
/**
721
* Log Levels
822
*
@@ -15,9 +29,5 @@
1529
* EMERGENCY (600): Emergency: system is unusable.
1630
*/
1731

18-
// create a log channel
19-
$log = new Logger('App');
20-
$log->pushHandler(new StreamHandler(LOG_PATH . '/app.log', Logger::DEBUG));
21-
2232
// add records to the log
23-
$log->info('My logger is now ready');
33+
$log->info('Logger is now ready');

app.test/app/ThirdParty/phpMailer.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
<?php
2+
3+
/**
4+
* PHPMailer – A full-featured email creation and transfer class for PHP
5+
*
6+
* The classic email sending library for PHP
7+
*
8+
* @link https://github.com/PHPMailer/PHPMailer
9+
*
10+
* @license GNU Lesser General Public License v2.1
11+
*/
12+
213
//Import PHPMailer classes into the global namespace
314
//These must be at the top of your script, not inside a function
415
use PHPMailer\PHPMailer\PHPMailer;

app.test/app/ThirdParty/scheduler.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
<?php
22

3+
/**
4+
* PHP Cron Scheduler
5+
*
6+
* This is a framework agnostic cron jobs scheduler that can be easily integrated with your project or run as a standalone command scheduler.
7+
*
8+
* @link https://github.com/peppeocchi/php-cron-scheduler
9+
*
10+
* @license MIT License
11+
*/
12+
313
use GO\Scheduler;
414

515
// Create a new scheduler
@@ -9,4 +19,4 @@
919
$scheduler->php(SCHEDULER_PATH . '/job.php')->at('* * * * *');
1020

1121
// Let the scheduler execute jobs which are due.
12-
$scheduler->run();
22+
$scheduler->run();

app.test/schedulers/job.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
echo 'hi';
44

5+
56
if (in_array('fail', $argv)) {
67
exit(1);
7-
}
8+
}

app.test/server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
ini_set('display_errors', 0);
2020
}
2121

22-
// Sends your logs to files, sockets, inboxes, databases and various web services
23-
// require_once __DIR__ . '/app/ThirdParty/logger.php';
22+
// Monolog - Logging for PHP
23+
require_once __DIR__ . '/app/ThirdParty/logger.php';

laradock-example/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ APACHE_FOR_MAC_M1=false
399399

400400
### MYSQL #################################################
401401

402-
MYSQL_VERSION=latest
402+
MYSQL_VERSION=8.0
403403
MYSQL_DATABASE=default
404404
MYSQL_USER=default
405405
MYSQL_PASSWORD=secret
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* * * * * laradock /usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1

0 commit comments

Comments
 (0)