Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed not working logging mechanism on Windows #123

Merged
merged 3 commits into from
Oct 10, 2017

Conversation

ethouris
Copy link
Collaborator

@ethouris ethouris commented Oct 9, 2017

  1. Fixed linker errors on Windows when turned on logging (made the LogDispatcher::Proxy class public on Windows, as the logging API is actually used by external applications).

  2. Fixed crashing time formatting on Windows (The used %T formatting is probably nonportable; used the equivalent on Windows %X).

  3. Used direct constructor call when returning Proxy value from a helper function. Most likely the syntax of creating and returning a local variable was widely expanded on MSVC in debug mode, so the destructor was called in wrong place and caused that an empty message was displayed in the logs. Now when using the direct constructor call syntax, the temporary object is created outside the function so the destructor is called directly in the instruction starting from LOGC. This was a wrong prediction of behavior that was previously highly compiler-option dependent; this fixed one is independent on any implementation-dependent copy elision rules.

// Looxlike The %T is nonstandard and Windows
// uses %X here. And "excepts" when using %T.
#ifdef WIN32
strftime(tmp_buf, 512, "%X.", &tm);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix ident here and in the comment above

@@ -178,7 +179,7 @@ struct LogDispatcher

struct Proxy;

Proxy operator()();
Proxy operator()();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ident

@rndi rndi merged commit a097e67 into Haivision:dev Oct 10, 2017
@rndi
Copy link
Collaborator

rndi commented Oct 10, 2017

Thank you @ethouris !

@ethouris ethouris deleted the dev-fix-windows-logging branch January 17, 2018 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants