I am trying to create a custom logger for using it inside NameAndPassword Plugin https://github.com/skycocker/NameAndPassword
Log file not getting generated with SFAuthorizationPluginView
Have tried libraries like: Log4swift, CocoaLumberjack and also followed below link
https://stackoverflow.com/questions/7271528/how-to-nslog-into-a-file
override NSLog with a custom function using a macro. Example, add this class to your project:
// file Log.h
#define NSLog(args...) _Log(@"DEBUG ", _
FILE_,LINE,PRETTY_FUNCTION,args);
@interface Log : NSObject
void _Log(NSString *prefix, const char *file, int lineNumber, const char *funcName, NSString *format,...);
@EnD
// file Log.m
#import "Log.h"
@implementation Log
void _Log(NSString *prefix, const char *file, int lineNumber, const char *funcName, NSString *format,...) {
va_list ap;
va_start (ap, format);
format = [format stringByAppendingString:@"\n"];
NSString *msg = [[NSString alloc] initWithFormat:[NSString stringWithFormat:@"%@",format] arguments:ap];
va_end (ap);
fprintf(stderr,"%s%50s:%3d - %s",[prefix UTF8String], funcName, lineNumber, [msg UTF8String]);
[msg release];
}
@EnD
Issue:
It is a .bundle project which is invoked on system login. Log file is not getting generated and no error.
Also, noticed that using NSLog generates system log but only during sleep & lock/unlock mode, not in Login mode
Have someone faced this issue before?