Add Logger and Logger API into Sigma

This pull request adds a Logger to Sigma, and also fixes some bugs.