On this page:
$verbose
write-message-log
write-message
8.0

24 Printer

 (require xiden/printer) package: xiden

xiden/printer writes messages as bytes on output ports.

struct

(struct $verbose $message (message)
    #:prefab)
  message : $message?
A wrapper for a message that only appears to a user if (XIDEN_VERBOSE) is #t.

procedure

(write-message-log messages format-message)  void?

  messages : messy-log/c
  format-message : message-formatter/c
Writes every message m in messages using (write-message m format-message (current-output-port)).

procedure

(write-message m    
  [#:newline? newline?]    
  format-message    
  [out])  void?
  m : $message?
  newline? : any/c = #t
  format-message : message-formatter/c
  out : output-port? = (current-output-port)
Writes a message to out according to the values of (XIDEN_READER_FRIENDLY_OUTPUT), (XIDEN_FASL_OUTPUT), and (XIDEN_VERBOSE).

Given (and (not (XIDEN_VERBOSE)) ($verbose? m)), write-message does nothing.

Otherwise, write-message does the following:

(let ([to-send (if (XIDEN_READER_FRIENDLY_OUTPUT) m (format-message m))])
  (if (XIDEN_FASL_OUTPUT)
      (s-exp->fasl (serialize to-send) out)
      (if (XIDEN_READER_FRIENDLY_OUTPUT)
          (pretty-write #:newline? newline? to-send out)
          ((if newline? displayln display) to-send out))))

Note that newline? is ignored when using fasl output.