Logging

A crucial part of most software app projects is logging, and social robot applications are no different.

Dialog logging

The most crucial logging to do for most interactions is usually dialog-logging. This contains what the robot says, what the user says, what intents the robot classified the user utterance as and what states your dialog flow is in, when each of these events happen. One very common use-case of analyzing logs is to enrich the language model of the skill. In practice, this means analyzing the user-utterances that:

  • the system did not understand - i.e no Intent classified
  • the system understood wrong - i.e it classified the wrong intent

Further on, you probably want to analyze what actions the robot took based on the intent the system classified.

Setting up dialog logging

Furhat comes with a dialog logger that logs the above events to a JSON file. It also logs audio of the user utterances so that you can analyse the interacton. You can initialize logging with dialogLogger.startSession() anywhere in the flow. Optionally, you can add parameters:

  • name: name for the session (defaults to a timestamp), directory delimiters (such as / and \) will be replaced with a -.
  • maxLength: The maximum length of the logging (in seconds), after which it will end (default 600 = 10 minutes).
  • cloudToken: Furhat API token for additionally sending the log to Furhat cloud (you can get one at your furhat.io profile)
  • directory: If for any reason one wishes to provide a directory structure for log files, this parameter can be used. NOTE: When using this parameter our log-viewer will no longer work with your logs

The logging will automatically stop when either:

  • The maxLength has been reached (see above)
  • You call dialogLogger.endSession()
  • The skill terminates

On your developer machine, the logs end up in:

  • Windows: %userprofile%/.furhat/logs
  • Mac and Linux: ~/.furhat/logs

Log-viewer

If cloudToken is used as an optional parameter, logs will be stored in Furhat Cloud. You can view and delete these logs at the log-viewer page. You need to log in with the same user account that is associated with the API key used as cloudToken in the skill.

Logs created with cloudToken as a parameter are listed on the left side on the screen. Clicking on any of the logs will display the log of the interaction. You can listen to the audio files by clicking on the text.

Note: The audio files of the user will only be available when using the Google Recognizer.

Flow logging

Since you might, during your Furhat development, build quite complex flows with many states and transitions, we are also supplying a flow logger that logs all relevant info related to why certain flow transitions happened, what triggers were executed etc.

The flowlogger can be started from within a state, for example:


val logState = state {
    onEntry {
        val logFile = File("/directory/of/log/log.txt") //Log file can have any extension.
        flowLogger.start(logFile) //Start the logger
    }
}

The output in the file will look something like this:

A Ai:onEntry 
A goto B
A Ai:onExit 
B onEntry 
B call C
B/C onEntry 
B/C terminate 
B/C onExit 
B goto D
B onExit 
D onEntry 
D call E
D/E onEntry 
D/E onTime 
D/E raise testInstant
D/E D:onevent testInstant CustomEvent{event_name=testInstant, event_sessionId=, event_id=c3d55998-6331-4762-adbf-cbcab2536771, event_time=2020-08-03 14:55:29.9}