Update owner.js

Created function logError for frequently used code.
Simplified some if statements by using the numbers as booleans.