github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/debug.md (about) 1 # `debug` 2 3 > Debugging information 4 5 ## Description 6 7 `debug` has two modes: as a function and as a method. 8 9 ### Debug Method 10 11 This usage will return debug information about the previous function ran. 12 13 ### Debug Function: 14 15 This will enable or disable debugging mode. 16 17 ## Usage 18 19 **Enable or disable debug output:** 20 21 ``` 22 debug boolean -> <stdout> 23 ``` 24 25 **Output whether debug mode is enabled or disabled:** 26 27 ``` 28 debug -> <stdout> 29 ``` 30 31 **Run a pipeline with debug mode enabled:** 32 33 ``` 34 debug { code-block } -> <stdout> 35 ``` 36 37 **Print debugging information about the previous command:** 38 39 ``` 40 <stdin> -> debug -> <stdout> 41 ``` 42 43 ## Examples 44 45 **Running a code block with debugging:** 46 47 ``` 48 » debug 49 false 50 51 » debug { out "debug mode is now ${debug}" } 52 debug mode is now true 53 54 » debug 55 false 56 ``` 57 58 **Return debugging information on the previous function:** 59 60 ``` 61 » out "hello, world!" -> debug 62 { 63 "DataType": { 64 "Go": "[]string", 65 "Murex": "str" 66 }, 67 "Process": { 68 "Context": { 69 "Context": 0 70 }, 71 "Stdin": {}, 72 "Stdout": {}, 73 "Stderr": {}, 74 "Parameters": { 75 "Params": [ 76 "hello, world!" 77 ], 78 "Tokens": [ 79 [ 80 { 81 "Type": 0, 82 "Key": "" 83 } 84 ], 85 [ 86 { 87 "Type": 1, 88 "Key": "hello, world!" 89 } 90 ], 91 [ 92 { 93 "Type": 0, 94 "Key": "" 95 } 96 ] 97 ] 98 }, 99 "ExitNum": 0, 100 "Name": "echo", 101 "Id": 3750, 102 "Exec": { 103 "Pid": 0, 104 "Cmd": null, 105 "PipeR": null, 106 "PipeW": null 107 }, 108 "PromptGoProc": 1, 109 "Path": "", 110 "IsMethod": false, 111 "IsNot": false, 112 "NamedPipeOut": "out", 113 "NamedPipeErr": "err", 114 "NamedPipeTest": "", 115 "State": 7, 116 "IsBackground": false, 117 "LineNumber": 1, 118 "ColNumber": 1, 119 "RunMode": 0, 120 "Config": {}, 121 "Tests": { 122 "Results": null 123 }, 124 "Variables": {}, 125 "FidTree": [ 126 0, 127 3750 128 ], 129 "CreationTime": "2019-01-20T00:00:52.167127131Z", 130 "StartTime": "2019-01-20T00:00:52.167776212Z" 131 } 132 } 133 ``` 134 135 **Enable or disable debug mode:** 136 137 ``` 138 » debug on 139 true 140 141 » debug off 142 false 143 ``` 144 145 **Output whether debug mode is enabled or disabled:** 146 147 ``` 148 » debug 149 false 150 ``` 151 152 ## Detail 153 154 When enabling or disabling debug mode, because the parameter is a murex 155 boolean type, it means you can use other boolean terms. eg 156 157 ``` 158 # enable debugging 159 » debug 1 160 » debug on 161 » debug yes 162 » debug true 163 164 # disable debugging 165 » debug 0 166 » debug off 167 » debug no 168 » debug false 169 ``` 170 171 It is also worth noting that the debugging information needs to be written 172 into the Go source code rather than in Murex's shell scripting language. 173 If you require debugging those processes then please use Murex's `test` 174 framework 175 176 ## See Also 177 178 * [`runtime`](../commands/runtime.md): 179 Returns runtime information on the internal state of Murex 180 * [`test`](../commands/test.md): 181 Murex's test framework - define tests, run tests and debug shell scripts 182 183 <hr/> 184 185 This document was generated from [builtins/core/management/debug_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/management/debug_doc.yaml).