How can I log variables to a txt file?
The DevelDumperManagerInterface interface is implemented by DevelDumperManager. This class is in turn used as a service, 'devel.dumper'.

One way to use this function would be the following:

$ddumper = \Drupal::service('devel.dumper');
$ddumper-&gt;debug($variable_name);


Good luck!