>  Docs Center  >  Libraries  >  Markwardt  >  PRINTLOG

PRINTLOG

PRINTLOG

Name


  PRINTLOG

Author


  Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770
  craigm@lheamail.gsfc.nasa.gov

Purpose


  Captures transcript of console output

Calling Sequence


  PRINTLOG, d1, d2, ..., FORMAT=, LOG=LOG, /ONLYLOG, UNIT=UNIT

Description



  The PRINTLOG procedure provides the ability to print an arbitrary
  expression to the console or an open file UNIT, and also to
  capture the text in a "log" or archive. This archive can be used
  as a verbatim record of console output, which is especially useful
  when transactional history records must be maintained.
  The log itself is stored as an array of strings which is passed
  via the LOG keyword. PRINTLOG simply adds the current output to
  the existing array and returns. When the transaction is complete,
  the resulting array may be saved or printed as appropriate. For
  example, the following set of commands will accumulate a log which
  can be saved later:
    IDL> x = 0 & y = 1 & u = -17. & v = 12. ;;; CREATE A LOG
    IDL> PRINTLOG, X, Y, LOG=LOG
            0 1
    IDL> PRINTLOG, U, V, LOG=LOG
          -17.0000 12.0000
    IDL> PRINTLOG, 'Computation done.', LOG=LOG
    Computation done.
    IDL> print, log, format='(A)' ;;; PRINT THE LOG
            0 1
          -17.0000 12.0000
    Computation done.
   
  NOTE: Output to the console can be disabled and re-enabled using
  the DEFAULT_PRINT keyword. The DEFAULT_PRINT keyword affects the
  permanent state of PRINTLOG. When it is set to 0, then *all*
  subsequent console output will be disabled until DEFAULT_PRINT is
  reset to 1. Output will always be logged to the LOG;
  DEFAULT_PRINT only controls the console output. This can be
  useful to have a global switch which determines the governs the
  console activity of an application. However, only *one* global
  control variable is available.

Inputs



  d1, d2, ... - the variables or expressions to be printed, as in
                the PRINT or PRINTF commands. A maximum of twenty
                parameters are allowed.

Keywords



  LOG - input/output keyword, containing the accumulated transaction
        log. Upon input, LOG should be an array of strings
        containing previously accumulated log. Upon return, LOG
        will have any new output appended. If, upon input, LOG is
        undefined, or contains a single element (-1L or ''), then
        LOG will be initialized.
  FORMAT - a standard format statement, as used by STRING, PRINT or
            PRINTF.
            Default: default output formatting is used.
  UNIT - a file unit to be used for output. If UNIT is undefined or
          0, then output is made to the console.
          Default: undefined (console output).
  ONLYLOG - if set, then output will not be made to the screen, but
            it will still be archived to LOG. This may useful to
            record archane but important dianostic information that
            normally would not appear to the user.
  DEFAULT_PRINT - Change default behavior of PRINTLOG. If
                  DEFAULT_PRINT is 0 then all subsequent printlog's
                  will *not* be printed to the console, until
                  DEFAULT_PRINT is reset. If DEFAULT_PRINT is 1
                  then all subsequent printlog's will be printed to
                  the console.
                  Initial default: 1 (print to console)
                  Default: none (user must explicitly set)

Example


  See above.

See Also


  PRINT, PRINTF, STRING
  STATUSLINE - To print temporary status messages to console

Modification History


  Written, CM, June 1999
  Documented, CM, 25 Feb 2000
  Added STATUSLINE to "SEE ALSO," CM, 22 Jun 2000
  Be more intelligent about growing log if PRINTLOG will be called
    many times (secret NLOGLINES keyword parameter), CM, Feb 2003
  Corrected bug if N_PARAMS was larger than 10, (H. Krimm) CM, 13
    Feb 2003
  Added DEFAULT_PRINT keyword, CM, 10 Oct 2003

Todo


  Have a way to internally store the log, rather than the LOG
  keyword.
  $Id: printlog.pro,v 1.5 2003/11/24 00:08:23 craigm Exp $



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us