Changes between Initial Version and Version 1 of LoggingAPI


Ignore:
Timestamp:
Nov 24, 2014, 4:59:45 PM (11 years ago)
Author:
Eric Pettersen
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LoggingAPI

    v1 v1  
     1
     2= !Logging/Status API
     3
     4== Overview
     5
     6The logger handles status and non-status messages separately.
     7The only reason that the logger is involved in status messages at all is so that non-tools can present status messages.
     8Status messages are plain text only (though color can be specified).
     9Non-status messages allow for plain text and/or HTML/image logging.
     10
     11== Non-Status Logging
     12
     13The logger offer three functions for non-status logging:  `info()`, `warning()`,  and `error()`.
     14They all take the same arguments and keywords.
     15The single mandatory argument is a text string (message), which can be empty.
     16The optional keywords are:
     17||= Name =||= Default =||= Description =||
     18||= '''add_newline''' =||= ''True'' =||=Append newline to text before logging =||
     19||= '''image''' =||= ''None'' =||=A PIL image to log, in which case the text message is used as alt text for plain-text logs =||
     20||= '''is_html''' =||= ''False'' =||=Is text message HTML?  Use best effort to convert to plain text for plain-text logs =||
     21
     22== Status Logging
     23
     24All graphical tools have a !ToolWindow instance that provides the interface area that the tool will build its user interface within.
     25Such tools will issue status messages via the !ToolWindow's `status()` method.
     26If available, the message will be shown in the tool's own status area (there is no such area in the current implementation).
     27Otherwise the message (and arguments) will be forwarded to the logger's `status()` method,
     28which in turn will forward to the main window's `status()` method.
     29If there is no main window then the message will be dropped.
     30Non-tools can issue status messages by calling the logger's `status()` method directly.
     31
     32All the various `status()` methods have the same call signature.  The only mandatory argument is a plain text message string.
     33The primary keyword arguments are:
     34||= Name =||= Default =||= Description =||
     35||= '''color''' =||= "black" =||=Status text color =||
     36||= '''log''' =||= ''False'' =||=Also log the message using `info()` =||
     37||= '''secondary''' =||= ''False'' =||=Show message in the secondary status area =||
     38The secondary status area is typically used for "sub status" or very transitory messages.
     39For example, when Chimera 1 saves a session it shows "Saving session…" in the primary status area
     40and each sub step (''e.g.'' "Saving coordinates") is shown in the secondary area.
     41Another example is when !MultAlign Viewer shows residue-association information as the mouse moves,
     42it uses the secondary status area so that any primary status information isn't prematurely erased.
     43
     44Less frequently used keyword args are:
     45||= Name =||= Default =||= Description =||
     46||= '''blank_after''' =||= ''None'' =||=Number of seconds to show the message before clearing.  If ''None'', use user-specified default. =||
     47||= '''follow_with''' =||= ''""'' =||=Follow first status with this text =||
     48||= '''follow_time''' =||= ''20'' =||=How log, in seconds, before showing the '''follow_with''' text =||
     49||= '''follow_log''' =||= ''None'' =||=Whether to log the '''follow_with''' message.  If ''None'', use the '''log''' value. =||
     50Other keyword args may be added later as its determined that they're needed.