[feature] Improve logging feature and add log() API for #166