Skip to content

Commit 97cde24

Browse files
committed
ICL: Readme fixes.
1 parent 93341b5 commit 97cde24

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,27 @@ In progress...
116116
117117
## Advanced
118118
119+
#### Custom location
120+
121+
Sometimes it's needed to change location of the log files, for example, you want it to be dependent on some command's argument.
122+
If that is your case, just override `getLogPath` method in your command class:
123+
124+
```php
125+
class Foo extends Command
126+
{
127+
use Loggable;
128+
129+
protected function getLogPath()
130+
{
131+
$name = Str::replaceFirst(':', '/', $this->getName());
132+
$baz = $this->argument('baz');
133+
return storage_path("logs/{$name}/{$baz}/date.log");
134+
}
135+
136+
// ...
137+
}
138+
```
139+
119140
#### Accessing Monolog instance
120141
121142
This package is using [Monolog logging library](https://packagist.org/packages/monolog/monolog) with all of it's power.
@@ -126,12 +147,12 @@ If needed, you may access the underlying Monolog instance in a two ways:
126147
class Foo extends Command
127148
{
128149
use Loggable;
129-
150+
130151
public function handle()
131152
{
132153
$log = $this->icLogger();
133154
}
134-
155+
135156
// ...
136157
}
137158
```
@@ -141,27 +162,6 @@ If needed, you may access the underlying Monolog instance in a two ways:
141162
$log = $app('log.iclogger');
142163
```
143164
144-
#### Custom location
145-
146-
Sometimes it's needed to change location of the log files, for example, you want it to be dependent on some command's argument.
147-
If that is your case, just override `getLogPath` method in your command class:
148-
149-
```php
150-
class Foo extends Command
151-
{
152-
use Loggable;
153-
154-
protected function getLogPath()
155-
{
156-
$name = Str::replaceFirst(':', '/', $this->getName());
157-
$baz = $this->argument('baz');
158-
return storage_path("logs/{$name}/{$baz}/date.log");
159-
}
160-
161-
// ...
162-
}
163-
```
164-
165165
## Troubleshooting
166166
167167
#### Trait included, but nothing happens?

0 commit comments

Comments
 (0)