Is there a way to log clips.PrintFacts() ?

Pyc Liph
  • Pyc Liph
    Pyc Liph

    I am trying to use Python logging module.
    Is there a way to redirect clips.PrintFacts() and similar
    clips Print functions output from stdout into the logging file?
    I tried these:

      logging.debug('%s', clips.PrintAgenda())

    but none worked.
    I also tried to redirect standard output to a file,
    but the regular clips.PrintFacts() seems to not have been

    So, a question: is it possible to log a clips.Printxxxx() output
    to a log file?
    If yes, then how?

    • Hi Pyc,

      Actually, there's no way to log such functions (.PrintXxx) to a file: they were intended for interactive use. CLIPS uses a quite convoluted IO system, that I tried to make simpler - also by making these functions directly available.

      However, my implementation of the .PrintXxx() functions redirects its output directly to sys.stdout, so I don't see why it shouldn't work with redirection. Just to be safe, i tried it with a pipe to the "tee" command and the results of PrintFacts() were regularly logged. Are you perhaps using Windows? And if so, did you try to use the "-u" switch for Python?