Open silverhammermba opened 5 years ago
Hello, thanks for your feedback, can you try this:
#undef LOG_LEVEL_DEF
#define LOG_LEVEL_DEF myLogLevel
static const int myLogLevel = DDLogLevelVerbose;
[MQTTLog setLogLevel:myLogLevel];
This approach does not work for me. I have my ddLogLevel
in the pch file.
Temporary workaround:
Remove #import <MQTTClient/MQTTLog.h>
from MQTTClient.h
.
If you need to set the LogLevel
:
[NSClassFromString(@"MQTTLog") performSelector:@selector(setLogLevel:) withObject:@(ddLogLevel)];
@jcavar Your suggestion doesn't work. That does enable logging, but it isn't using CocoaLumberjack. I verified by setting breakpoints that it's just using MQTT's shim macros and never hitting any DDLog method.
Temporary workaround:
Remove
#import <MQTTClient/MQTTLog.h>
fromMQTTClient.h
.If you need to set the
LogLevel
:[NSClassFromString(@"MQTTLog") performSelector:@selector(setLogLevel:) withObject:@(ddLogLevel)];
thx
Short description
I can't get this to work with an app that is already using CocoaLumberjack 3.5.3 via Carthage because it causes conflicting definitions.
I set up my logging like this in
Logging.h
Then in my view controller
That
DDLogError
gives me two errors:extern DDLogLevel ddLogLevel;
from MQTTLog.h#define DDLogError if (ddLogLevel & DDLogFlagError) NSLog
If I remove the
@import MQTTClient;
it builds and logging works. If I remove the#import "Logging.h"
it also builds, but I can see that it isn't using CocoaLumberjack because it no longer respects my logging level.Environment
Steps to reproduce
@import MQTTClient;
Expected behaviour
There should be some way to import CocoaLumberjack and MQTTClient via Carthage and have MQTTClient use my CocoaLumberjack config.
Actual behaviour
Currently I can only find a way to use one or the other, not both.
Other information
I see that there's a
#ifdef LUMBERJACK
in MQTTLog.h. I tried adding#define LUMBERJACK
before I import MQTTClient, but it makes no difference. What does work is if I actually delete the contents of MQTTLog.h, then it builds fine.Also, not sure if related, even when I import MQTTClient on its own, I can't get it to log anything. For example, I see that it's supposed to log an error if I try to open an base MQTTTransport instance, but I don't see those logs appearing.