3 ms·
These don't seem like very practical interfaces to me. One of the nice features of glog is when you log at a high severity it flushes all the output buffers and
by jeffbee 6y ago
These don't seem like very practical interfaces to me. One of the nice features of glog is when you log at a high severity it flushes all the output buffers and syncs the files. For this to work, the lowest level of glog has to be aware of the severity. If you cut off that knowledge in the middle of your interface (by serializing the log early, and passing down []byte) then you don't have the information you need at the right place and time.
This library author should have realized their error when they needed to add the parseLevel function to get the severity back out of the formatted output.
Aside from the weird interface, this library is pretty cavalier about unix file i/o. This function will never notice that all its writes are failing. https://github.com/phuslu/log/blob/master/file.go#L67-L96 https://github.com/phuslu/log/blob/master/file.go#L67-L96
- marvinblum 6y agoAlso little things like the w.mu.Unlock() at the end of the function instead of using defer show that this was probably written by (Go) beginners.