Closed amitt0488 closed 4 years ago
Also, noticed that using NSLog generates system log but only during sleep & lock/unlock mode, not in Login mode
Issue was that log file was getting generated only in tmp folder. When i set the path to tmp folder, logs got generated. Thanks
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.