Skip to content

Commit 7a13d71

Browse files
author
Ayman Bedair
committed
Adding example of logging in the examples file
1 parent 52fbd1a commit 7a13d71

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/run.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
include_once __DIR__ . '/../vendor/autoload.php';
33

44
use aymanrb\UnstructuredTextParser\TextParser;
5+
use Monolog\Logger;
6+
use Monolog\Handler\StreamHandler;
57

68
try {
7-
$parser = new TextParser(__DIR__ . '/templates');
9+
$logger = new Logger('text-parser');
10+
$logger->pushHandler(new StreamHandler('logs/text-parser.log', Logger::DEBUG));
811

12+
$parser = new TextParser(__DIR__ . '/templates', $logger);
913
$textFiles = new DirectoryIterator(__DIR__ . '/test_txt_files');
1014

1115
foreach ($textFiles as $txtFileObj) {

0 commit comments

Comments
 (0)