Examples of how to log in Drupal 8
//System is unusable
\Drupal::logger('codimth_controller')->emergency($message);
//Action must be taken immediately
\Drupal::logger('codimth_controller')->alert($message);
//Critical conditions
\Drupal::logger('codimth_controller')->critical($message);
//Tipical errors, as when the page doesn't load
\Drupal::logger('codimth_controller')->error($message);
//warning conditions
\Drupal::logger('codimth_controller')->warning($message);
// Normal information
\Drupal::logger('codimth_controller')->notice($message);
// Interesting events
\Drupal::logger('codimth_controller')->info($message);
// debug information
\Drupal::logger('codimth_controller')->debug($message);
To see recent log messages in your website go to /admin/reports/dblog
and you'll show page like this.