Adun  0.83
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Static Public Member Functions
ULMessageLog Class Reference

#import <ViewController.h>

List of all members.

Public Member Functions

(id) - initWithLogView:
(void) - logString:newline:
(void) - logString:newline:forProcess:
(void) - logAttributedString:
(void) - logDivider
(void) - show:
(void) - showLine:
(void) - showLine:formatting:
(NSDictionary *) - formattings
(BOOL) - showsTimestamp
(void) - setShowsTimestamp:

Static Public Member Functions

(void) + setDefaultAppLog:
(id) + defaultAppLog

Detailed Description

Class providing an interface to GUI elements which present formatted textual information to the user. ULMessageLog presents this information in a LIFO order - that is the most recent string logged via a ULMessageLog instance will appear at the top of the corresponding GUI text view.

ULMessageLog has a number of roles :

ULMessageLog can be used to interact with any NSTextView. You simply provide the textView on instantiation.

messageLog = [[ULMessageLog alloc] initWithLogView: aTextView];

Main Application Log

The logview in the main Adun window is set as the default ULMessageLog instance. Any class/script can access this log by using the defaultAppLog (ULMessageLog) class method. This is the methoded non-threaded GUI scripts should use to present information to the user.

Member Function Documentation

+ (id) defaultAppLog

Returns the default message log for the application. This is usually the text view in the main Adun window.

- (NSDictionary *) formattings

Returns a dictionary whose keys are the four formatting values defined in showLine:formatting: and whose values are dictionaries of NSAttributedString attribute/value pairs.

- (id) initWithLogView: (id)  view

Returns a newly initialised ULMessageLog instance for logging information to view.

viewUsually an NSTextView instance.
- (void) logAttributedString: (NSAttributedString*)  string

Oututs the NSAttributedString string to the top of the logview

- (void) logDivider

Logs the string '——————' to the text view (with two newlines appended)

- (void) logString: (NSString*)  string
newline: (BOOL)  newline 

Outputs string to the top of the logView. If newLine is YES a newline character is appended to the string

- (void) logString: (NSString*)  string
newline: (BOOL)  newline
forProcess: (ULProcess*)  process 

As logString:newline: but prepending information about process to the logged string (PID)

+ (void) setDefaultAppLog: (ULMessageLog*)  log

Description forthcoming

- (void) setShowsTimestamp: (BOOL)  value

Turn on/off timestamping of logged strings.

- (void) show: (id)  anObject

As showLine: but without appending a newline.

- (void) showLine: (id)  anObject

As showLine:formatting: passing STDefaultFormatting

- (void) showLine: (id)  anObject
formatting: (NSString *)  formatting 

Logs the string returned by [anObject description], appending a newline and highlighting it according to formatting.

anObjectAny object
formattingNSString defining how the decription string will be highlighted in the log-view

formatting can have the following values

  • STResultFormatting
  • STErrorFormatting
  • STDefaultFormatting
  • STScriptFormatting

STDefaultFormatting is white (i.e. no highlighting). Experiment with the others to see what colours they produce.

- (BOOL) showsTimestamp

Returns YES if the reciever adds a timestamp to the strings it logs. NO otherwise.