Scribusoid

Author Topic: Logging (Especially For Windows)  (Read 1251 times)

jlpoole

  • Newbie
  • *
  • Posts: 26
  • Karma: 0
  • Scribus User
Logging (Especially For Windows)
« on: June 17, 2015, 06:02:33 am »
I've built a basic logging function using the format of modules so that logging may be accomplished with a simple:
Code: [Select]
printD("log this comment")
printDt("log that comment with a tab")

The log files have date and timestamps before each entry, separated by a space for printD and a tab for printDt.

If I see several people saying this would be useful to them, I'll go ahead and try to share it.

I found being unable to log stuff in Windows really hampered my ability to debug and develop.

I've also address how to create modules under the share/scripts directory so that libraries of useful routine may be built -- this is something I see that is much needed here.
John L. Poole

work: Principal Software Engineer, Oracle Corporation
play: Editions Poole - publisher of classical ensemble piano music (using InDesign & scripts thereunder)

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1884
  • Karma: 26
    • the graphics lab
Re: Logging (Especially For Windows)
« Reply #1 on: June 17, 2015, 11:50:09 am »
yep, indeed on windows it must be hard to get feedback from the scripter!

one thing i did, and never really documented, is to create a fake Scribus class (a mock...) that enables to run the python script outside of scribus, making it much easier to test it from your preferred environment.

you can see it in action here:

https://github.com/aoloe/scribus-script-repository/blob/master/typographic-grid/typographic-grid.py

(if it fails importing scribus (which will happen if the script is not run inside of scribus), it will create a Scribus class with the methods used in the Scribus).

if there is an interest for it, we/i can look for a way to make that more general (eventually mock the full API?) and document it...
but it's not one of my priorities right now...

Rummidge

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Scribus User
Re: Logging (Especially For Windows)
« Reply #2 on: June 30, 2015, 06:24:53 pm »
I am using it!

Thanks for making life easier.  ;D

I wonder if there is a way for using PyDev (Eclipse) remote debugging facilities, as it would be fantastic to set breakpoints, inspect variable names and so on...

Meanwhile, your hack is really helpful.