ORKLogFormatter Class Reference
Inherits from | NSObject |
---|---|
Declared in | ORKDataLogger.h |
The ORKLogFormatter
class represents the base (default) log formatter, which appends data
blindly to a log file.
A log formatter is used by a data logger to format objects
for output to the log, and to begin a new log file and end an existing log file.
ORKLogFormatter
accepts NSData and has neither a header nor a footer.
A log formatter should ensure that the log is always in a valid state, so that even if the app is killed, the log is still readable.
– canAcceptLogObjectOfClass:
Returns a Boolean value that indicates whether the log formatter can serialize the specified type of object.
- (BOOL)canAcceptLogObjectOfClass:(Class)c
Parameters
c |
The class of object to serialize. |
---|
Return Value
YES
if the log formatter can serialize this object class; otherwise, NO
.
Declared In
ORKDataLogger.h
– canAcceptLogObject:
Returns a Boolean value that indicates whether the log formatter can serialize the specified type of object.
- (BOOL)canAcceptLogObject:(id)object
Parameters
object |
The object to serialize. |
---|
Return Value
YES
if the log formatter can serialize object
; otherwise, NO
Declared In
ORKDataLogger.h
– beginLogWithFileHandle:error:
Begins a new log file on the specified file handle.
- (BOOL)beginLogWithFileHandle:(NSFileHandle *)fileHandle error:(NSError *_Nullable *)error
Parameters
fileHandle |
The file handle to which to write. |
---|---|
error |
The error output, on failure. |
Return Value
YES
if the write succeeds; otherwise, NO
.
Discussion
For example, may write a header or opening stanza of a new log file.
Declared In
ORKDataLogger.h
– appendObject:fileHandle:error:
Appends the specified object to the log file.
- (BOOL)appendObject:(id)object fileHandle:(NSFileHandle *)fileHandle error:(NSError *_Nullable *)error
Parameters
object |
The object to write. |
---|---|
fileHandle |
The file handle to which to write. |
error |
The error output, on failure. |
Return Value
YES
if the write succeeds; otherwise, NO
.
Declared In
ORKDataLogger.h
– appendObjects:fileHandle:error:
Appends the specified objects to the log file.
- (BOOL)appendObjects:(NSArray *)objects fileHandle:(NSFileHandle *)fileHandle error:(NSError *_Nullable *)error
Parameters
objects |
The objects to write. |
---|---|
fileHandle |
The file handle to which to write. |
error |
The error output, on failure. |
Return Value
YES
if the write succeeds; otherwise, NO
.
Declared In
ORKDataLogger.h