laravel-debugbar
laravel-debugbar copied to clipboard
[feature request] debug/log/info/warning calls to show file and line
Would be great if all the debugging functions would also display the filename:line where they were called from.
Is there a possibility of that happening? Thanks
I'd really like this too and came here to see if it was possible.
I'd actually like to be able to also define what the filename and line number are, as my use case is that I wrap my debugging things in a function, and so want the script that called my debugging function to be displayed, not the function itself. Currently I am outputting this as part of the log message, but it is cluttering it up.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
Is there any chance that something like this would be picked up?
Would a PR be accepted?
C'mon, throw us a bone over here :sweat_smile:
Hmm, I guess that could work. Run a backtrace on it or something.
So for me, I would like the option of passing in what I would like displayed as the file and line number, as I have wrapped the log function in another function - so would want it to display the calling location of my function.
I'm using this as a fallback if $log_script isn't filled in the function call:
if (empty($log_script)) {
$back_trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
$calling_script = array_shift($back_trace);
$file_parts = explode("/", str_replace('\\', '/', $calling_script['file']));
$script_name = array_pop($file_parts);
$log_script = $script_name . ": " . $calling_script['line'];
}
Currently I have mimicked the behaviour I want by extending the MessagesCollector to receive the $log_script, and putting this string in the 'collector' key for the message, but it is a bit hacky. It does show up on individual collectors, but in the aggregated one still shows the collector name - probably there is something else I'd need to extend to do that.
Ideally, I would like a simpler way to just push custom text to the right hand side of the output. Potentially being able to 'stack' (vertically or horizontally) those "right hand side messages" so it could display both the collector name, location info, and/or anything else I wanted to add there.
A bonus would be if those "right hand side messages" would be filterable ;)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
Looks like there was a start at a PR for this. Would like to see it kept open.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
Keep open
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
keep open
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
keep open