You might also want to replace the /debug alias so that you don't accidentally mess up the logging. For example:

Code:
alias debug { echo -a Oops! Use /dbon and /dboff instead. }
alias dbon { if ($window($debug)) { window -a $debug } }
alias dboff { if ($window($debug)) { window -h $debug } }

on *:CLOSE:@:{ if ($target == $debug) { .timer 1 0 startdb } }

alias startdb {
  window -h @raw $+ $cid
  !debug -i @raw $+ $cid dbparse
}

alias dbparse {
  ; your commands here
  return $1-
}