jainyzau
Results
1
issues of
jainyzau
您好!在最近的学习中遇到了这样的问题,就是进程刚启动时,如果因为某些原因退出,则日志不能flush到文件中。当然这只是一个小问题,改起来应该比较容易,我只是在这里提出来。 示例代码如下,应该是没有来得及进入`AsyncLogging::threadFunc()`中的`while`循环,`running_`已经变成`false`。虽然`while`循环之后有`output.flush()`,但是此时还没有写到`output`中。 ``` cpp #include #include #include std::shared_ptr gpAsyncLogging; void async_log_output(const char* msg, int len) { gpAsyncLogging->append(msg, len); } void async_log_flush() { // do nothing } int main() { gpAsyncLogging.reset(new...