Home  >  Article  >  Backend Development  >  Unable to open file name

Unable to open file name

王林
王林forward
2024-02-08 21:03:041545browse

Unable to open file name

Question content

I received the following error log:

2023/12/27 04:11:26 open : The system cannot find the file specified.

I have many function calls, for example:

    pth := "..."

    data, err := os.ReadFile(pth)
    if err != nil {
        log.Fatalf(err.Error())
    }

Easier Debugging

I want to modify the error logs so that they write the exact name of the file that cannot be opened. Is there an automated way to force the log to do this?


Correct answer


As @icza commented:

As for me:

The above is the detailed content of Unable to open file name. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete