xp-forge / terminal

Terminal control
0 stars 0 forks source link

terminal confused by debug output #2

Closed kiesel closed 8 years ago

kiesel commented 8 years ago

When using a LogCategory with a ConsoleAppender, I receive this stacktrace when running a program:

*** Exception lang.IndexOutOfBoundsException (Undefined index: views)
  at <main>::__error(8, (0x16)'Undefined index: views', (0x6e)'/home/idev/dev/bitbucket-jenkins-mapper/vendor/xp-forge/terminal', 45, array[6]) [line 45 of Terminal.class.php]
  at util.cmd.term.Terminal::transition((0x5)'views') [line 71 of Terminal.class.php]
  at util.cmd.term.Terminal::format((0x560)'[14:23:22 10460 debug] <<< peer.http.HttpResponse (HTTP/1.1 200 ') [line 13 of Output.class.php]
  at util.cmd.term.Output::write((0x560)'[14:23:22 10460 debug] <<< peer.http.HttpResponse (HTTP/1.1 200 ') [line 66 of StringWriter.class.php]
  at io.streams.StringWriter::write((0x560)'[14:23:22 10460 debug] <<< peer.http.HttpResponse (HTTP/1.1 200 ') [line 31 of ConsoleAppender.class.php]
  at util.log.ConsoleAppender::append(util.log.LoggingEvent{}) [line 116 of LogCategory.class.php]
  at util.log.LogCategory::log(8, array[3]) [line 294 of LogCategory.class.php]
  at util.log.LogCategory::debug((0x3)'<<<', (0x133)'peer.http.HttpResponse (HTTP/1.1 200 OK) {', (0x410)'<?xml version="1.0" encoding="UTF-8"?><com.cloudbees.hudson.plug') [line 255 of RestClient.class.php]
  at webservices.rest.RestClient::execute(webservices.rest.RestRequest{}) [line 175 of Scan.class.php]
  at org.oneandone.bitbucket.cmd.Scan::existsJenkinsItem((0x9)'bit-infra') [line 161 of Scan.class.php]
  at org.oneandone.bitbucket.cmd.Scan::syncProjectToFolder(array[7]) [line 70 of Scan.class.php]
  at org.oneandone.bitbucket.cmd.Scan::run() [line 444 of Runner.class.php]
  at xp.command.Runner::run(util.cmd.ParamString{}) [line 151 of Runner.class.php]
  at xp.command.Runner::main(array[8]) [line 0 of StackTraceElement.class.php]
  at ReflectionMethod::invokeArgs(NULL, array[1]) [line 90 of Method.class.php]
  at lang.reflect.Method::invoke(NULL, array[1]) [line 348 of class-main.php]
thekid commented 8 years ago

Fix released in 0.3.0, although using < and > poses quite a bit of problems and creates ambiguity. Maybe using another, less-common character pair, would be better after all.

Console::writeLine('\c{red}...\c');  // For "color"
Console::writeLine('\s{red}...\s');  // For "style" - though \s is known from regexes for space
Console::writeLine('\e{red}...\e');  // For "escape" - close to original but '\e' and "\e" differ!
thekid commented 8 years ago

Solved issue with multiple arguments in 0.4.0, added <>...</> for outputting raw argument. Closing for the moment.