Home > Mobile >  How do I create code snippets for vscode for get only the file name and line number using debug back
How do I create code snippets for vscode for get only the file name and line number using debug back

Time:01-25

How do I create code snippets for vscode for get only the file name and line number using debug backtrace function in php ? I want only filename and line number using debug_backtrace();.

CodePudding user response:

The following code can be pasted into vscode global code snippets:

"debug_backtrace": {
"prefix": "_debug_backtrace_file_line_Only",
"body": [
    "$$trace = debug_backtrace();",
    "$$print_file = fopen('custom_log.log','a');",
    "foreach ($$trace as $$call) {",
    "    fwrite($$print_file,print_r(\"File: {$$call['file']}, Line: {$$call['line']}\\\n\",true));",
    "}"
],
"description": "debug_backtrace print file name and line number only"
}

For More Help you can follow this link : https://github.com/msrajawat298/msrajawat298/blob/main/vs-code-help/vs-code-user-snippets.json

  • Related