Question

I'm working on chat app using xmppframework in iOS. The framework contain sample demo that print send and receive log for xml. Now I implement same things in my app but no log is showing.

Example of log for sample app

2014-05-08 16:34:15:993 iPhoneXMPP[4839:1403] SEND: <?xml version='1.0'?>
2014-05-08 16:34:15:994 iPhoneXMPP[4839:1403] SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='meinantrieb.net'>
2014-05-08 16:34:16:384 iPhoneXMPP[4839:3503] RECV: <stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" id="1364620848" from="meinantrieb.net" version="1.0" stream1:lang="en"/>
2014-05-08 16:34:16:384 iPhoneXMPP[4839:3503] RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>SCRAM-SHA-1</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism></mechanisms><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.process-one.net/en/ejabberd/" ver="GgBjinftMQ4H81m+4jSVXMg/dVU="/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>

Code For Adding Log in AppDelegate.m

#import "DDLog.h"
#import "DDTTYLogger.h"

// Log levels: off, error, warn, info, verbose
#if DEBUG
static const int ddLogLevel = LOG_LEVEL_VERBOSE;
#else
static const int ddLogLevel = LOG_LEVEL_INFO;
#endif
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Configure logging framework
    [DDLog addLogger:[DDTTYLogger sharedInstance]];
}

Any help or suggestion will be well appreciated.

Was it helpful?

Solution

use this line to replace the code of configuring logging framework

[DDLog addLogger:[DDTTYLogger sharedInstance] withLogLevel:XMPP_LOG_FLAG_SEND_RECV]

it is copied from the demo code of XMPPFramework

OTHER TIPS

With Swift 3.x, DDLog log levels are an enum, so it's not immediately possible to apply the XMPPFramework log levels.

One can enable all log messages:

DDLog.add(DDTTYLogger.sharedInstance, with: .all)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top