EGLOG doesn't work

This is for the photon cloud with a swift client.

EGLOG in demo_iPhone_loadBalancing_swift is ok but I can't use it in my app. My current theory is that EGLOG is not defined for my app but it is defined in the demo. But when I look at the demo I am unsure where it gets defined.



  • Hi @GreenRollingHills.

    To be able to call 'EGLOG()', an instance of type 'EGLogger' must be accessible through 'self.Logger' in the calling code.

    But when I look at the demo I am unsure where it gets defined.

    It doesn't.
    EGLOG() gets defined in EGLogger.h of Common objC.

    EGLOG in demo_iPhone_loadBalancing_swift is ok

    I have just tried that, but it isn't ok in the demo. That demo does not use EGLOG() at all and can't find its definitions when you just at a call to EGLog() without further changes to the demo code.

    You can have a look at demo_iphone_loadBalancing for how to use it from an objective C demo.

    Currently only our C++ and objective C demos use it, but not the Swift ones.
  • edited June 2017

    Thanks for your response.

    In demo_iPhone_loadBalancing_swift there is the LoadBalancing-objc sub project. In the LoadBalancing-objc sub project there is In I added EGLOG(INFO, L"testing testing 123") at the beginning of:

    - (bool) connect:(EGAuthenticationValues*)authenticationValues :(NSString*)username :(NSString* const)serverAddress :(nByte)serverType;

    It does appear to work.

    However, in my app when I reference the same (at least I think so...) LoadBalancing-objc sub project which references the same the EGLOG(INFO, L"testing testing 123") doesn't print to the console.
  • KaiserludiKaiserludi admin
    edited June 2017
    Hi @GreenRollingHills.

    Ah, now I get what you mean. Sorry for the misunderstanding. We don't consider the LoadBalancing-objc project to be part of the demo, but rather a part of the Client libraries.

    Please note that EGLOG() does NOT print to the console. We consider it bad style for a library to directly log to the console without giving the app control about where it wants the logs to be printed.
    Therefor EGLOG() just adds additional information (date, time, log-level, file, line and function of the call) and then passes the resulting string to debugReturn().
    Then it is up to your implementation of debugReturn() what to do with this string.

    demo_loadBalancing_swift for example passes the string to self.demoView.log(). self.demoView is an instance of class ViewController, so the string ends up in ViewController::log(), which simply prints it to the console via print().

    My guess is that your apps implementation of debugReturn() does not do anything.

    Examples of what it could do with the received log strings:
    - simply print them to the console
    - filter them and react different to them depending on the values of parameter 'debugLevel'
    - print them to a text file
    - print them to the screen
    - print them to a text file and send that text file to an external server, so that you could look into the log output of your app that gets produced on the devices of your customers and for example track how often certain errors get logged
    - print messages that have at least the debug level 'errors' or 'warnings' as pop up message
    - etc.
  • Hey,

    Thanks for your response! That explains things.
Sign In or Register to comment.