Skip to content

Commit 223115b

Browse files
committed
Add facade
1 parent 75783af commit 223115b

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

readme.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ Add it to your providers array in `config/app.php`:
2727
Hedii\LaravelGelfLogger\LaravelGelfLoggerServiceProvider::class
2828
```
2929

30+
If you want to use the facade, add it to your aliases array in `config/app.php`:
31+
32+
```php
33+
'GelfLogger' => \Hedii\LaravelGelfLogger\Facades\GelfLogger::class
34+
```
35+
3036
Publish the configuration file:
3137

3238
```sh
@@ -77,4 +83,4 @@ composer test
7783

7884
## License
7985

80-
laravel-gelf-logger is released under the MIT Licence. See the bundled [LICENSE](https://github.com/hedii/laravel-gelf-logger/blob/master/LICENSE.md) file for details.
86+
laravel-gelf-logger is released under the MIT Licence. See the bundled [LICENSE](https://github.com/hedii/laravel-gelf-logger/blob/master/LICENSE.md) file for details.

src/Facades/GelfLogger.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Hedii\LaravelGelfLogger\Facades;
4+
5+
use Illuminate\Support\Facades\Facade;
6+
7+
class GelfLogger extends Facade
8+
{
9+
/**
10+
* Get the registered name of the component.
11+
*
12+
* @return string
13+
*/
14+
protected static function getFacadeAccessor() {
15+
return 'gelf-logger';
16+
}
17+
}

tests/GelfLoggerTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ public function test_it_should_return_a_logger_instance_when_the_helper_is_used(
1616
{
1717
$this->assertInstanceOf(Logger::class, gelf());
1818
}
19-
}
19+
20+
public function test_it_should_have_a_facade()
21+
{
22+
$this->assertTrue(class_exists(\GelfLogger::class));
23+
}
24+
}

tests/TestCase.php

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

33
namespace Hedii\LaravelGelfLogger\Tests;
44

5+
use Hedii\LaravelGelfLogger\Facades\GelfLogger;
56
use Hedii\LaravelGelfLogger\LaravelGelfLoggerServiceProvider;
67
use Orchestra\Testbench\TestCase as Orchestra;
78

@@ -19,4 +20,13 @@ protected function getPackageProviders($app)
1920
LaravelGelfLoggerServiceProvider::class
2021
];
2122
}
22-
}
23+
24+
/**
25+
* @param \Illuminate\Foundation\Application $app
26+
* @return array
27+
*/
28+
protected function getPackageAliases($app)
29+
{
30+
return ['GelfLogger' => GelfLogger::class];
31+
}
32+
}

0 commit comments

Comments
 (0)