loguru icon indicating copy to clipboard operation
loguru copied to clipboard

Hi, I made some changes.

Open scinart opened this issue 8 years ago • 3 comments

I make the following changes. I hope it looks good to you.

  • a travis-ci.yml is added for automatic building and testing.
  • windows specific __declspec(thread) was replaced by keyword thread_local
  • add test about thread naming.
  • Enable file-only logging (please see the commit message of 55a56120b8a820c7c86d20c2e371d94076ecd2ed)

scinart avatar Aug 18 '17 20:08 scinart

Hi, thanks for your PR!

Some notes

__declspec(thread) was introduced in https://github.com/emilk/loguru/pull/36 by @justinian and I don't want to change that unless it still works on old VC versions.

About the file-only logging: I think you misunderstood my TODO: I want a way to be able to do LOG_F(INFO, "Both file and stderr"); LOG_F(FILE, "Only file"); – i.e. control it on a per-message basis, not globally.

The other things look good – I might cherry pick a few commits

emilk avatar Oct 07 '17 21:10 emilk

Just to weigh in - I did choose the older-style __declspec(thread) for compatibility reasons. The thread_local keyword wasn't well supported until Visual Studio 2015. You could support both through a _MSC_VER check, but that seems like more of a maintenance headache for a single keyword.

justinian avatar Oct 08 '17 07:10 justinian

Just to weigh in - I did choose the older-style __declspec(thread) for compatibility reasons. The thread_local keyword wasn't well supported until Visual Studio 2015. You could support both through a _MSC_VER check, but that seems like more of a maintenance headache for a single keyword.

Would you reconsider using #ifdefs because the __declspec(thread) is ignored by the current MinGW-W64 compiler, but thread_local is supported? See https://github.com/sccn/liblsl/blob/master/testing/test_int_loguruthreadnames.cpp for a test that fails on MinGW unless thread_local is used.

tobiasherzke avatar Jul 03 '21 09:07 tobiasherzke