Logging

Re-factored logging functions to take the current env pointer instead of trying to acquire one.