add log system

clean code + replace some assert by log.error (code more robust)