-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f0cde66
Showing
29 changed files
with
6,086 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
### Logger initialization: | ||
|
||
```php | ||
|
||
require_once "vendor/autoload.php"; | ||
|
||
use Tleckie\Log\Handler\StreamHandler; | ||
use Tleckie\Log\Handler\FileHandler; | ||
use Tleckie\Log\Level; | ||
use Tleckie\Log\Log; | ||
|
||
$handlers = [ | ||
new StreamHandler(Level::DEBUG), | ||
new FileHandler(Level::DEBUG, '/tmp/error.log') | ||
]; | ||
|
||
$log = new Log($handlers); | ||
|
||
class DummyToString { | ||
public function __toString(): string | ||
{ | ||
return 'My string'; | ||
} | ||
} | ||
|
||
class DummySerialize implements \JsonSerializable { | ||
public function jsonSerialize() | ||
{ | ||
return [ | ||
'value1', | ||
'value2' | ||
]; | ||
} | ||
} | ||
|
||
$log->alert(new Exception('Test alert message'),[1,2]); | ||
$log->critical('Test critical message: {A} => {B}', ['A' => '(A value)', 'B' => '(B value)']); | ||
$log->info('Test info message'); | ||
$log->error(new Exception('Test error message')); | ||
$log->emergency('Test emergency message'); | ||
$log->emergency(['{A}' => 155555, '{B}' => 99999], ['A' => '(A value)', 'B' => '(B value)']); | ||
$log->emergency(['A' => 155555, 'B' => 99999]); | ||
$log->emergency(new class(){}); | ||
$log->emergency(new DummyToString()); | ||
$log->emergency(new DummySerialized()); | ||
``` | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "tleckie/log", | ||
"license": "LGPL-3.0-only", | ||
"description": "Simple PSR-3 log", | ||
"type": "library", | ||
"homepage": "https://github.com/teodoroleckie/log", | ||
"authors": [ | ||
{ | ||
"name": "Teodoro Leckie Westberg", | ||
"email": "teodoroleckie@gmail.com" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Tleckie\\Log\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Tleckie\\Log\\Tests\\": "tests/" | ||
} | ||
}, | ||
"provide": { | ||
|
||
}, | ||
"require": { | ||
"php": "^8", | ||
"psr/log": "^1.1" | ||
}, | ||
"require-dev": { | ||
"infection/infection": "^0.21.5", | ||
"phpunit/phpunit": "^9.5", | ||
"mikey179/vfsstream": "^1.6", | ||
"friendsofphp/php-cs-fixer": "v3.0.0-beta.2" | ||
}, | ||
"config": { | ||
"sort-packages": true, | ||
"optimize-autoloader": true, | ||
"vendor-dir": "vendor", | ||
"bin-dir": "bin" | ||
}, | ||
"scripts": { | ||
"php-cs-fixer": "php-cs-fixer --rules=@PSR1" | ||
} | ||
} |
Oops, something went wrong.