fix(logger): print to stderr if log fails for default format#2830
fix(logger): print to stderr if log fails for default format#2830ReneWerner87 merged 1 commit intogofiber:mainfrom
Conversation
We log to stderr if logging fails when a custom format is used, but not for the default format. This change addresses this inconsistency.
|
One other thing I noticed was that the log write is only protected by a mutex lock when the non-default format is used. Perhaps we should be locking in both places...? |
There should not be issue when writing logs to a file using POSIX |
|
Thought about the locking some more. It's probably not a good idea for fiber to add locking. Since os.File operations are goroutine safe, and since I'm sure >99% of cases will be logging to os.File, it's probably better to have users implement locking in their Write methods. Either way, I'll follow up with a separate PR later. |
Description
We log to stderr if logging fails when a custom format is used, but not for the default format. This change addresses this inconsistency.
Type of Change
Please delete options that are not relevant.
Checklist
Before you submit your pull request, please make sure you meet these requirements: