Add debug and trace calls to apply and agent

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #3 from kbarber/debug_for_apply

Add debug and trace calls to apply and agent