All Classes Namespaces Files Functions Pages
logging.tcl
1 ##
2 # @brief Basic namespace for all Excentis Tcl extensions
3 #
4 namespace eval excentis {
5 
6 ##
7 # @brief This namespace holds all ByteBlower-related Tcl extensions, including the ByteBlower higher-layer Tcl API.
8 #
9 # These procedures are developed for higher-level usage of the ByteBlower API.
10 # They are mainly used to simplify running specific Test Scenarios similar to
11 # scenarios you know from the ByteBlower GUI.
12 #
13 namespace eval ByteBlower {
14 
15 # This files includes helper functions to perform logging tasks.
16 
17 package require excentis_basic
18 
19 ##
20 # 0: ERROR
21 # 1: WARNING
22 # 2: INFO
23 # 3: DEBUG
24 set LOG_LEVELS [ list "ERROR" "WARNING" "INFO" ]
25 
26 proc x.Print.Debug { args } {
27  if { [ lsearch $::excentis::ByteBlower::LOG_LEVELS "DEBUG" ] != -1} {
28  if { [ llength ${args} ] > 1} {
29  set channel [ lindex $args 0 ]
30  set msg [ lrange $args 1 end ]
31  } else {
32  set channel stdout
33  set msg [ lindex $args 0 ]
34  }
35 
36  puts ${channel} "\[DEBUG\] $msg"
37  }
38 }
39 
40 
41 }
42 
43 }