Added Api.Log and small bug fix

Added API Log method for hosted plugins
Fixed a bug when a plugin fails to load it would try to use an
uninitialized variable