omdl  v0.9.5
OpenSCAD Mechanical Design Library
Console Output

Console message logging. More...

+ Collaboration diagram for Console Output:

Files

file  console.scad
 Message logging functions.
 

Functions

function stack (b=0, t=0)
 Format the function call stack as a string. More...
 
module log_echo (m)
 Output message to console. More...
 
module log_type (t, m)
 Output diagnostic message to console. More...
 
module log_debug (m)
 Output diagnostic message to console. More...
 
module log_info (m)
 Output information message to console. More...
 
module log_warn (m)
 Output warning message to console. More...
 
module log_error (m)
 Output error message to console. More...
 

Detailed Description

Console message logging.

Requires:
include <omdl-base.scad>;

Console script

include <omdl-base.scad>;
$log_debug = true;
message = "console log message";
// general
log_echo( message );
// type
log_type( "MY_TYPE", message );
// debugging
log_debug( message );
log_debug( message, $log_debug = false );
// information
log_info( message );
// warning
log_warn( message );
// error
log_error( message );
// end_include
module log_debug(m)
Output diagnostic message to console.
Definition: console.scad:302
module log_warn(m)
Output warning message to console.
Definition: console.scad:333
module log_error(m)
Output error message to console.
Definition: console.scad:365
module log_echo(m)
Output message to console.
Definition: console.scad:272
module log_type(t, m)
Output diagnostic message to console.
Definition: console.scad:284
module log_info(m)
Output information message to console.
Definition: console.scad:318

Console script output

ECHO: "console log message"
ECHO: "[ MY_TYPE ] console log message"
ECHO: "[ DEBUG ] root(); console log message"
ECHO: "[ INFO ] root(); console log message"
ECHO:
ECHO: "root()"
ECHO: "###################################"
ECHO: "# [ WARNING ] console log message #"
ECHO: "###################################"
ECHO:
ECHO: "root()"
ECHO: "###################################"
ECHO: "###################################"
ECHO: "## ##"
ECHO: "## [ ERROR ] console log message ##"
ECHO: "## ##"
ECHO: "###################################"
ECHO: "###################################"

Function Documentation

◆ log_debug()

module log_debug ( )

Output diagnostic message to console.

Parameters
m<string> An output message.

Message is written if and only if $log_debug is true.

Definition at line 302 of file console.scad.

+ Here is the call graph for this function:

◆ log_echo()

module log_echo ( )

Output message to console.

Parameters
m<string> An output message.

Definition at line 272 of file console.scad.

+ Here is the caller graph for this function:

◆ log_error()

module log_error ( )

Output error message to console.

Parameters
m<string> An output message.

Output an error message to the console.

Note
Starting with version 2019.05, the assert functions which can be used to generate an error condition and halt script processing.

Definition at line 365 of file console.scad.

+ Here is the call graph for this function:

◆ log_info()

module log_info ( )

Output information message to console.

Parameters
m<string> An output message.

Definition at line 318 of file console.scad.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ log_type()

module log_type ( ,
 
)

Output diagnostic message to console.

Parameters
t<string> An output message type.
m<string> An output message.

Definition at line 284 of file console.scad.

+ Here is the caller graph for this function:

◆ log_warn()

module log_warn ( )

Output warning message to console.

Parameters
m<string> An output message.

Definition at line 333 of file console.scad.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stack()

function stack ( = 0,
= 0 
)

Format the function call stack as a string.

Parameters
b<integer> The stack index bottom offset. Return function names above this offset.
t<integer> The stack index top offset. Return function names below this offset.
Returns
<string> A string-formatted colon-separated list of functions names for the current function call stack.
Note
Returns undef when b is greater than the current number of function instances (ie: b > $parent_modules-1).
Returns the string "root()" when the function call stack is empty (ie: at the root of a script).
+ Here is the caller graph for this function: