Skip to content

Commit

Permalink
changed VarDumper::export() to VarDumper::dumpAsString()
Browse files Browse the repository at this point in the history
  • Loading branch information
RomeroMsk committed Oct 2, 2015
1 parent dd378bd commit 0b4a4cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions GraylogTarget.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,21 @@ public function export()
if ($short !== null) {
$gelfMsg->setShortMessage($short);
// All remaining message is fullMessage by default
$gelfMsg->setFullMessage(VarDumper::export($text));
$gelfMsg->setFullMessage(VarDumper::dumpAsString($text));
} else {
// Will use log message as shortMessage by default (no need to add fullMessage in this case)
$gelfMsg->setShortMessage(VarDumper::export($text));
$gelfMsg->setShortMessage(VarDumper::dumpAsString($text));
}
// If 'full' is set will use it as fullMessage (note that all other stuff in log message will not be logged, except 'short' and 'add')
if ($full !== null) {
$gelfMsg->setFullMessage(VarDumper::export($full));
$gelfMsg->setFullMessage(VarDumper::dumpAsString($full));
}
// Process additionals array (only with string keys)
if (is_array($add)) {
foreach ($add as $key => $val) {
if (is_string($key)) {
if (!is_string($val)) {
$val = VarDumper::export($val);
$val = VarDumper::dumpAsString($val);
}
$gelfMsg->setAdditional($key, $val);
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ return [

GraylogTarget will use traces array (first element) from log message to set `file` and `line` gelf fields. So if you want to see these fields in Graylog2, you need to set `traceLevel` attribute of `log` component to 1 or more. Also all lines from traces will be sent as `trace` additional gelf field.

You can log not only strings, but also any other types (non-strings will be exported by `VarDumper::export()`).
You can log not only strings, but also any other types (non-strings will be dumped by `yii\helpers\VarDumper::dumpAsString()`).

By default GraylogTarget will put the entire log message as `short_message` gelf field. But you can set `short_message`, `full_message` and `additionals` by using `'short'`, `'full'` and `'add'` keys respectively:
```php
Expand Down

0 comments on commit 0b4a4cb

Please sign in to comment.