Skip to content

Allowing logger to make subdirectories #520

Open
@marabucz

Description

Having some clients with attitude of "prove me this is NOT your problem" or "prove me this WAS really done" I'm really happy for logger, however... some projects grew nastily, and having to log basically anything important just to be sure I won't be burnt and blamed for everything I started having an urge to split logs. The first logical idea was Debugger::log('mail sent', 'mails-'. date('Y-m'))

That's cool, because now you have all your mails together - mails-2012-09, mails-2012-10 etc., but it would be probably better to have them in directories. Like 2021-12/mails, 2021-12/orders, 2021-12/smartemailing etc. The good thing is logger allows that, as https://github.com/nette/tracy/blob/master/src/Tracy/Logger/Logger.php#L63 works even with directories. The bad part is... you need to create directories first. It would be really awesome to have something like
if(!is_dir($dir = dirname($file))) { @mkdir($dir); }

on the line 64... I mean I know I can make my own logger and thus solve this (and basically add that date('Y-m') right into constructor, so I don't have to thing about dividing my logs into directories and in that case even my errors etc. would be splitted, but it would be still a nice feature into standard one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions