FMLiveSwitchLogProvider Class Reference

Base class for all logging provider implementations. More...

Instance Methods

(void) - doLogWithLogEvent:
 Logs a message at the specified log level. More...
 
(FMLiveSwitchFunction1< FMLiveSwitchLogEvent *, id > *) - filter
 Gets a filter on the log provider. More...
 
(NSString *) - generateLogLineWithLogEvent:
 Generates a default log line. More...
 
(NSString *) - getPrefixWithLevel:includeTimestamp:
 Converts a log-level to a 5-character string for consistently-spaced character sequences. More...
 
(instancetype) - init
 Initializes a new instance of the FMLiveSwitchLogProvider class using defaultLogLevel (FMLiveSwitchLog) as the log level. More...
 
(FMLiveSwitchLogLevel) - level
 Gets the log level. More...
 
(void) - logWithLogEvent:
 Log a message. More...
 
(int) - processId
 Gets the current process id. More...
 
(void) - setFilter:
 Sets a filter on the log provider. More...
 
(FMLiveSwitchLogEvent *) - setFilterBlock
 Sets a filter on the log provider. More...
 
(void) - setFilterBlock:
 Sets a filter on the log provider. More...
 
(void) - setLevel:
 Sets the log level. More...
 

Class Methods

(NSString *) + getLogLevelStringWithLevel:
 Converts a log-level to a 5-character string for consistently-spaced character sequences. More...
 
(NSString *) + getPrefixTimestamp:
 Converts a timestamp to an ISO-8601-formatted string for rendering in a log message (YYYY-MM-DDThh:mm:ss.sssZ). More...
 
(NSString *) + getProduct
 Returns the name of the current product. More...
 
(FMLiveSwitchLogProvider *) + logProvider
 Initializes a new instance of the FMLiveSwitchLogProvider class using defaultLogLevel (FMLiveSwitchLog) as the log level. More...
 

Detailed Description

Base class for all logging provider implementations.

Method Documentation

◆ doLogWithLogEvent:

- (void) doLogWithLogEvent: (FMLiveSwitchLogEvent *)  logEvent

Logs a message at the specified log level.

Parameters
logEventThe log event details.

Implemented in FMLiveSwitchTextLogProvider, FMLiveSwitchNullLogProvider, FMLiveSwitchLogStashLogProvider, and FMLiveSwitchLogEventLogProvider.

◆ filter

- (FMLiveSwitchFunction1<FMLiveSwitchLogEvent*,id>*) filter

Gets a filter on the log provider.

Returning true will log the event, while returning false will skip it.

◆ generateLogLineWithLogEvent:

- (NSString*) generateLogLineWithLogEvent: (FMLiveSwitchLogEvent *)  logEvent

Generates a default log line.

Parameters
logEventThe log event details.

◆ getLogLevelStringWithLevel:

+ (NSString*) getLogLevelStringWithLevel: (FMLiveSwitchLogLevel)  level

Converts a log-level to a 5-character string for consistently-spaced character sequences.

Parameters
levelThe log level.
Returns
The log level as an upper-case string with right-side whitespace padding to ensure a 5-character sequence.

◆ getPrefixTimestamp:

+ (NSString*) getPrefixTimestamp: (NSDate *)  timestamp

Converts a timestamp to an ISO-8601-formatted string for rendering in a log message (YYYY-MM-DDThh:mm:ss.sssZ).

Parameters
timestampThe timestamp.
Returns
The timestamp as a formatted string.

◆ getPrefixWithLevel:includeTimestamp:

- (NSString*) getPrefixWithLevel: (FMLiveSwitchLogLevel)  level
includeTimestamp: (bool)  includeTimestamp 

Converts a log-level to a 5-character string for consistently-spaced character sequences.

Parameters
levelThe log level.
includeTimestampWhether to include a timestamp in the prefix.
Returns
The log level as an upper-case string with right-side whitespace padding to ensure a 5-character sequence.

◆ getProduct

+ (NSString*) getProduct

Returns the name of the current product.

◆ init

- (instancetype) init

◆ level

- (FMLiveSwitchLogLevel) level

Gets the log level.

◆ logProvider

+ (FMLiveSwitchLogProvider*) logProvider

Initializes a new instance of the FMLiveSwitchLogProvider class using defaultLogLevel (FMLiveSwitchLog) as the log level.

◆ logWithLogEvent:

- (void) logWithLogEvent: (FMLiveSwitchLogEvent *)  logEvent

Log a message.

Parameters
logEventThe log event details.

◆ processId

- (int) processId

Gets the current process id.

◆ setFilter:

- (void) setFilter: (FMLiveSwitchFunction1< FMLiveSwitchLogEvent *, id > *)  value

Sets a filter on the log provider.

Returning true will log the event, while returning false will skip it.

◆ setFilterBlock

- (FMLiveSwitchLogEvent*) setFilterBlock

Sets a filter on the log provider.

Returning true will log the event, while returning false will skip it.

◆ setFilterBlock:

- (void) setFilterBlock: (bool(^)(FMLiveSwitchLogEvent *))  valueBlock

Sets a filter on the log provider.

Returning true will log the event, while returning false will skip it.

◆ setLevel:

- (void) setLevel: (FMLiveSwitchLogLevel)  value

Sets the log level.