EGLOG doesn't work

Options
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.

Thanks,

Comments

  • Kaiserludi
    Options
    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.
  • GreenRollingHills
    edited June 2017
    Options
    Hello,

    Thanks for your response.

    In demo_iPhone_loadBalancing_swift there is the LoadBalancing-objc sub project. In the LoadBalancing-objc sub project there is EGLoadBalancingClient.mm. In EGLoadBalancingClient.mm 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 EGLoadBalancingClient.mm the EGLOG(INFO, L"testing testing 123") doesn't print to the console.
  • Kaiserludi
    Kaiserludi admin
    edited June 2017
    Options
    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.