natively logging sys.path modifications

Hi, sys.path is kind of important thing for troubleshooting. It may worth to ship it with a logging mechanism that allows to quickly dump who added what and (optionally) why. I see the log as a circular memory buffer of limited size, to say 256 entries, that contains tuples in the following format: path, who, where, why path -- actual path added to sys.path who -- the context - package.module:function or - package.module:class.method or - package.module:__toplevel__ where -- full filename and line number to the instruction why -- advanced API may allow to set this field -- anatoly t.

On Wed, Jun 24, 2015 at 11:07 PM, anatoly techtonik <techtonik@gmail.com> wrote:
It should be possible for you to replace sys.path with an object of your own invention, a subclass of list that records the above information whenever it's modified. Install that early, then let all the other changes get logged. Or have you tried this and found that it breaks something? ChrisA

On 24/06/2015 14:07, anatoly techtonik wrote:
You see the log and somebody else does the work for you as you refuse to sign the CLA. Do you want your bread buttered on both sides, or will one side suffice? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence

On Wed, Jun 24, 2015 at 11:07 PM, anatoly techtonik <techtonik@gmail.com> wrote:
It should be possible for you to replace sys.path with an object of your own invention, a subclass of list that records the above information whenever it's modified. Install that early, then let all the other changes get logged. Or have you tried this and found that it breaks something? ChrisA

On 24/06/2015 14:07, anatoly techtonik wrote:
You see the log and somebody else does the work for you as you refuse to sign the CLA. Do you want your bread buttered on both sides, or will one side suffice? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
participants (3)
-
anatoly techtonik
-
Chris Angelico
-
Mark Lawrence