Create user facing messages

The Splunk Machine Learning Toolkit (MLTK) ships with utilities to make user-facing errors easy to manage.

Note: MLTK relies on a different Python interpreter than the interpreter that ships with Splunk Enterprise.

Complete the following steps:

  1. Import and create a messages logger:
    from cexc import get_messages_logger
    messages = get_messages_logger()
    
  2. Add user facing messages:
    1. Use the following syntax to add a warning message:
      some_variable = 'hello there'
      messages.warn('Message of your choosing: {}'.format(some_variable))
      
      Userfacingmessage.png
    2. Use the following syntax to add an error messages:
      some_variable = 'hello there'
      messages.error('Message of your choosing: {}'.format(some_variable))
      
      Userfacingmsg2.png