core/output

Bash Script Output Support

Dependency Graph

core/output: Library Dependencies

View color source code (raw) for this file

View reStructuredText (rst) source code for this page

Output Configuration

$timestamps

If set to true, prefixes stderr with a timestamp.

Default: true

$nanoseconds

If non-empty, timestamps will include nanoseconds.

Default: null

$app_log_hook

Name of function that implements app_log_pipe.

Default: app_log_stub

$error_usage_hook

Name of function that implements error_usage.

Default: error_usage_stub

Logging Hook

app_log

Calls app_log_hook

script_log_pipe_stub

This definition is a temporary handler for debugging
library loading. When the script library is loaded, it is replaced by the final version located therein.

Timestamps

timestamp()

Prints a timestamp if $timestamps is true. If $nanoseconds is non-empty, the timestap will include nanoseconds.

Basic Output

_app_echo()

If logging is enabled, pipes the arguments ($@) to the logging function (app_log()); otherwise, this simply echos them.

app_echo()

Prints the arguments ($@), prefixed with timestamp().

app_echo_n()

Same as app_echo() but suppresses the trailing newline.

Namespace Output

app_msg()

Prints arguments ($@) with app_echo(), prefixed with the current command namespace.

app_msg_if()

Prints a message with app_msg()

Information, Warnings, and Errors

error()

Prints an error message ($*) to stderr and (conditionally) displays a stack trace.

Returns: Always returns false.

warn()

Prints a warning message ($*) to stderr unless $quiet is true.

info()

Prints an information message ($*) to stderr if $verbose is true.

debug()

Prints an debugging message ($*) to stderr if $verbose is true.

Error Usage Hook

error_usage()

Prints an error ($*) and current command usage.

error_usage_stub()

This stub prints an unadorned error; the core/commands library provides a version to print the usage information.

Assertions

assert()

Calls error() with a message ($1) if a command ($@) does not return success.

assert_usage()

Same as assert() but calls error_usage() instead of error().

Stack Traces

stack_raw()

Prints the current stack in its raw form: the built-in variables that describe it.

stack_trace()

Prints the current stack, if $debug is true.


View the Developer Guide Index

View the Reference Manual Index


Generated on Wed Jun 28 07:41:10 PDT 2017 by mcsh d14 v0.20.0.