Giter Club home page Giter Club logo

aixlog's People

Contributors

99r avatar badaix avatar vooidptr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aixlog's Issues

mixed output using threads

Hi, I use 4 threads and sometimes is output mixed and logs inarticulate. Is exist any good practis how to use it is this situation?

gcc warns of "Function defined but not used"

Hello, thanks for your header only logger. I've found it very nice so far.

I do like to compile with -Wall when using gcc, and I get these warnings apparently from using internally linked functions.

Would you consider adding something like: https://gist.github.com/cinnaboot/80cc12ffa6095c8db325be631fc1bb1f to supress the warnings?

I got the macro from this thread https://cboard.cprogramming.com/cplusplus-programming/118695-help-remove-warning-x-function-defined-but-not-used.html that also suggests inlining to get around it.

Compilation of the example fails

[1/3] /usr/bin/c++   -I/usr/ports/devel/aixlog/work/aixlog-1.3.0/include -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer   -std=c++11 -MD -MT CMakeFiles/aixlog_example.dir/aixlog_example.cpp.o -MF CMakeFiles/aixlog_example.dir/aixlog_example.cpp.o.d -o CMakeFiles/aixlog_example.dir/aixlog_example.cpp.o -c /usr/ports/devel/aixlog/work/aixlog-1.3.0/aixlog_example.cpp
FAILED: CMakeFiles/aixlog_example.dir/aixlog_example.cpp.o 
/usr/bin/c++   -I/usr/ports/devel/aixlog/work/aixlog-1.3.0/include -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer   -std=c++11 -MD -MT CMakeFiles/aixlog_example.dir/aixlog_example.cpp.o -MF CMakeFiles/aixlog_example.dir/aixlog_example.cpp.o.d -o CMakeFiles/aixlog_example.dir/aixlog_example.cpp.o -c /usr/ports/devel/aixlog/work/aixlog-1.3.0/aixlog_example.cpp
In file included from /usr/ports/devel/aixlog/work/aixlog-1.3.0/aixlog_example.cpp:15:
/usr/ports/devel/aixlog/work/aixlog-1.3.0/include/aixlog.hpp:531:22: error: no matching constructor for initialization of 'std::thread::id' (aka 'std::__1::__thread_id')
    Log() noexcept : last_id_(-1), last_buffer_(nullptr)
                     ^        ~~
/usr/include/c++/v1/__threading_support:416:28: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const std::__1::__thread_id' for 1st argument
class _LIBCPP_TEMPLATE_VIS __thread_id
                           ^
/usr/include/c++/v1/__threading_support:416:28: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'std::__1::__thread_id' for 1st argument
/usr/include/c++/v1/__threading_support:465:5: note: candidate constructor not viable: no known conversion from 'int' to 'std::__1::__libcpp_thread_id' (aka 'pthread *') for 1st argument
    __thread_id(__libcpp_thread_id __id) : __id_(__id) {}
    ^
/usr/include/c++/v1/__threading_support:425:5: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
    __thread_id() _NOEXCEPT : __id_(0) {}
    ^
1 error generated.

OS: FreeBSD 12.1
clang-9

Not logging last entry

Hello,

I find this library quite usefull, but i've just found a bug.
When calling multiple times LOG, latest entry is not logged. As well as when called only once, nothing in log file is created. For example:
LOG(WARNING) << "Warning";
LOG(INFO) << "Information";
Only "Warning" gets outputed.
Furthermore, when calling two times same severity of logging, example:
LOG(WARNING) << "Warning";
LOG(WARNING) << "Warning";
Nothing is logged, until you change severity.

Can it use in threads?

`
int i[2] = { 0,1 };

string t[2] = { R"(E:\product\qqm\cv_pro\log\t1.log)",R"(E:\product\qqm\cv_pro\log\t2.log)" };

thread t1(&xxxx, i[0], t[0].c_str());

thread t2(&xxxx, i[1], t[1].c_str());

t1.join();

t2.join();

system("pause");

`
i want to use it in thread, as this code
i want log every thread with a single log file ,
can aixlog do it?
this 1.4 version do not work well , create two log files, but only ont have the log info

doesn't compil under visual studio 2017

Hello,

Just to let you know, your code can't compil under Visual Studio 2017 due to a compilation bug:

error C2216: 'explicit' can't be used with 'virtual' for the line 287.

It is a bug in visual studio as explicit should be usable with virtual, but visual studio has this bug from the 2013 version, so I don't expect a fix soon.

Great job anyway, just one more question that is not in the documentation: is your logging library thread-safe?

Mute the log when no initialisation has been done?

I'm using aixlog in a project with a big amount of files and functions useful to perform various calculations which will be recycled by multiple binaries. Not all these binaries might need to log their output, but when I do not use any initialisation the result is still printed to cout, except in a more garbled form (with no spaces). Is it possible to make it the default to not print anything unless an initialisation has been performed?

64-bit windows builds are broken since uncode version of windows api is called

You'd better replace

OutputDebugString with OutputDebugStringA
RegisterEventSource with RegisterEventSourceA
ReportEvent with ReportEventA

You should call the "A" version of these functions explicitly, since you pass ansi char strings to them.
Otherwise 64-bit windows builds are broken. OutputDebugString is defined to OutputDebugStringW on 64-bit platform and compiler can not convert const char* to required LPCWSTR.

Build fail on Windows - Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e

aixlog.hpp(847,1): error C2664: 'void OutputDebugStringA(LPCSTR)': cannot convert argument 1 from 'const _Elem *' to 'LPCSTR' 
...
aixlog.hpp(1008,1): error C2664: 'HANDLE RegisterEventSourceA(LPCSTR,LPCSTR)': cannot convert argument 2 from 'const _Elem *' to 'LPCSTR'
...
aixlog.hpp(1038,1): error C2664: 'BOOL ReportEventA(HANDLE,WORD,WORD,DWORD,PSID,WORD,DWORD,LPCSTR *,LPVOID)': cannot convert argument 8 from 'const wchar_t **' to 'LPCSTR *'

After Explicitly typecasting to LPCSTR * , the build goes through.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.