improve code, add 'log' method, add 'all' event