On this page:
3.1 Basic Interface
unlike-assets-logger
make-child-logger
<fatal
<error
<info
<debug
<warning
<log/  cm
<log
3.2 Building Reports
with-report
with-report/  void
with-report/  counts
3.3 Display Parameters
show-debug?
show-colors?
show-prefix?
show-all-events?
show-level?
error-port-levels
prescribed-prefix
format-clear
format-unclear
7.7

3 Logging

 (require unlike-assets/logging)
  package: unlike-assets-lib

The behavior of unlike-assets is difficult to trace without logging, hence this module. You should use this module with your own build process to ensure consistent output, especially when using the CLI.

3.1 Basic Interface

This logger uses the 'unlike-assets topic, has no parent, and subscribes to all levels of detail.

procedure

(make-child-logger)  logger?

Creates a child of unlike-assets-logger on the same topic.

procedure

(<fatal message-fmt v ...)  void?

  message-fmt : string?
  v : any/c

procedure

(<error message-fmt v ...)  void?

  message-fmt : string?
  v : any/c

procedure

(<info message-fmt v ...)  void?

  message-fmt : string?
  v : any/c

procedure

(<debug message-fmt v ...)  void?

  message-fmt : string?
  v : any/c

procedure

(<warning message-fmt v ...)  void?

  message-fmt : string?
  v : any/c
Like <log/cm on the named levels. This is what you will use most of the time to log formatted messages to unlike-assets-logger.

procedure

(<log/cm level message v ...)  void?

  level : log-level/c
  message : string?
  v : any/c
Equivalent to:

(<log level
      (apply format (cons message v))
      (current-continuation-marks))

procedure

(<log level message data)  void?

  level : log-level/c
  message : string?
  data : any/c
A specialized wrapper around log-message for unlike-assets-logger. Use this when leveraging multiple threads with prescribed-prefix.

3.2 Building Reports

procedure

(with-report proc)  
any/c dict?
  proc : (-> any/c)
Calls proc such that any log messages sent to unlike-logger are intercepted and forwarded to the printer. Messages are customized using several parameters. See Display Parameters.

Returns the value returned from proc, and a dictionary holding counts for the number of each event encountered during evaluation of proc. If no events are captured for a level, the dictionary will still hold the level as a key with a value of 0.

procedure

(with-report/void proc)  void?

  proc : (-> any/c)
Like with-report, except the return values are discarded.

procedure

(with-report/counts proc)  dict?

  proc : (-> any/c)
Like with-report, except only the event counts dictionary is returned.

3.3 Display Parameters

value

show-debug? : (parameter/c boolean?) = #f

Informs receivers if 'debug events should be displayed to the end user.

value

show-colors? : (parameter/c boolean?) = #f

If #t, log messages will include ANSI color codes.

value

show-prefix? : (parameter/c boolean?) = #f

If #t, the logger topic "unlike-assets: " will prefix each log message.

If #t, the logger will include all events in end-user output, not just those for the 'unlike-assets topic.

Combined with (show-debug? #t), this can be extremely noisy. Use only if detailed feedback from Racket internals matter for your purposes.

value

show-level? : (parameter/c boolean?) = #f

If #t, prefix each log message with the message’s level of detail.

value

error-port-levels : (parameter/c (listof log-level/c))

 = '(fatal error)
Controls which levels are forwarded to (current-error-port) be default. Typically you would change this if you want to (not) count warnings as errors or constrict STDOUT to a single level without using another process.

A string prefix applied to every message. This is useful in things like multi-threaded builds where each thread needs to identify itself.

These procedures prepare clear and unclear dependency references for placement in a log message. The output will be printed in display mode.