KLogger icon indicating copy to clipboard operation
KLogger copied to clipboard

writing arrays

Open cgapperi opened this issue 5 years ago • 1 comments

From the first example it appears arrays should be written to log. When I try to include an array, I get

PHP Notice: Array to string conversion in /data/Data_Cleaning/CvR/wip_plib/vendor/katzgrau/klogger/src/Logger.php on line 285

log shows

[2019-02-27 10:30:01.878930] [info] Array [2019-02-27 10:30:01.879091] [info] /data/Data_Cleaning/CvR/wip_pbin/file_cleaning/rename/NEX* [2019-02-27 10:30:01.879139] [info] Found: nex [2019-02-27 10:30:01.879228] [debug] Array [2019-02-27 10:30:01.879385] [info] NEX_IMR_01012019 renamed nex_wk01_01012019.txt [2019-02-27 10:30:01.879467] [info] NEX_IMR_01022019 renamed nex_wk01_01022019.txt [2019-02-27 10:30:01.879591] [info] NEX_IMR_01032019 renamed nex_wk01_01032019.txt [2019-02-27 10:30:01.879656] [info] NEX_IMR_01042019 renamed nex_wk01_01042019.txt [2019-02-27 10:30:01.879723] [info] NEX_IMR_01052019 renamed nex_wk01_01052019.txt [2019-02-27 10:30:01.879789] [info] NEX_IMR_01062019 renamed nex_wk01_01062019.txt [2019-02-27 10:30:01.879880] [info] NEX_IMR_01072019 renamed nex_wk01_01072019.txt [2019-02-27 10:30:01.879951] [info] NEX_IMR_01082019 renamed nex_wk02_01082019.txt [2019-02-27 10:30:01.880014] [info] NEX_IMR_01092019 renamed nex_wk02_01092019.txt

Am I missing something?

cgapperi avatar Feb 27 '19 16:02 cgapperi

Can you post an example of usage?

From the docs, the second params should accept objects/arrays:

$logger->debug('Got these users from the Database.', $users);

katzgrau avatar Feb 27 '19 18:02 katzgrau