Is there a way to supress particular messages or a class of messages on the screen? Is there a way of suppressing a particular class of messages from being displayed on the screen, such as the one displayed below? 


  Deprecated function: Methods with the same name as their class will
  not be constructors in a future version of PHP; GeSHi has a deprecated
  constructor in require_once() (line 837 of
  {site_root}/sites/all/modules/libraries/libraries.module)


It comes up all the time and it belongs  to the php and severity debug class of error messages.

I don't want to turn off the display of messages on the screen, just a particular class of message which come so often they are a nuisance.

It is possible to toggle their display on and off when required but still log them to the database?
You can use Disable Messages or look how they do it. Among other features you'll get a permission to specifically hide all messages of a given type from any role.


  Gives a site owner options to disable specific messages shown to end
  users. The core drupal message system as offered by drupal_set_message
  is an excellent way for modules to send out messages to the end users.
  However not all drupal site owners are keen to show all the messages
  sent out by drupal core and all modules to their users. This module
  gives site administrators a reasonably powerful way to filter out
  messages shown to the end users.
  
  Features
  
  
  Filter out messages that match a full text string exactly.
  Filter out messages that match a regular expression.
  Permissions to specifically hide all messages of a given type from any role.
  Disable all filtering for specific users.
  Disable all filtering for specific paths.
  Apply filtering only for specific paths.
  Debug system to get messages in the HTML without showing it to the end users.
  




Apart from that I found this little gem:

function MYMODULE_preprocess_status_messages(&amp;$variables) {

  // The exact message you want to filter.
  $message = 'Further instructions have been sent to your e-mail address.';

  if (isset($_SESSION['messages'])) {
    foreach ($_SESSION['messages'] as $type =&gt; $messages) {

      // Limit it to a certain type if you want to.
      if ($type == 'status') {

        $pos = array_search($message, $messages);

        if ($pos !== FALSE) {
          unset($_SESSION['messages'][$type][$pos]);
        }
      }
    }
  }
}


Source: https://api.drupal.org/comment/51793#comment-51793



Here's another alternative to filter all messages of a certain type.

/**
 * Implements hook_page_build().
 */
function MYMODULE_page_build(&amp;$page) {

  $hide_types = ['status', 'error', 'warning'];

  if (isset($_SESSION['messages'])) {
    foreach ($_SESSION['messages'] as $type =&gt; $messages) {
      if (in_array($type, $hide_types)) {
        unset($_SESSION['messages'][$type]);
      }
    }
  }
}


You could also easily get the $account = global $user and check its roles to tighten this request if you need.



Last but not least – not recommended - you can remove or if-wrap the &lt;?php print $messages; ?&gt; variable in your theme's page.tpl.php. But editing templates for this kind of logic should be considered bad practice.