Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2016-10-15 11:54:55

etc
Developer
Registered: 2010-11-11
Posts: 5,153
Website GitHub

Output debug info only to logged-in users

The title says it all. If you do some dev on a live site, sometimes you need to put it in debug mode to test new features. This exposes your kitchen to everybody, additionally slowing down the site. I suggest that we introduce a preference that will allow to hide debug info from external eyes.

Offline

#2 2016-10-15 13:21:42

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Output debug info only to logged-in users

+1


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#3 2016-10-15 13:36:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,434
Website GitHub

Re: Output debug info only to logged-in users

In theory, yes it’s a good idea. Since new features (parser etc) can impact public tags, we’ll have to be extra cautious when testing dev code that we’re not in this mode of operation so we don’t unintentionally hide any errors.

Will a fourth production status suffice? Private debugging or something?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2016-10-15 15:01:36

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: Output debug info only to logged-in users

Safe Production Status?

Offline

#5 2016-10-15 17:46:35

etc
Developer
Registered: 2010-11-11
Posts: 5,153
Website GitHub

Re: Output debug info only to logged-in users

Bloke wrote #302206:

Will a fourth production status suffice? Private debugging or something?

candyman wrote #302209:

Safe Production Status?

I don’t know. I would squat the Testing mode for this. What is it’s purpose anyway?

Offline

#6 2016-10-15 19:29:30

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,434
Website GitHub

Re: Output debug info only to logged-in users

etc wrote #302211:

I don’t know. I would squat the Testing mode for this. What is it’s purpose anyway?

I use it all the time. On my dev site, when testing plugins for 4.6.0 for example, pretty much every damn public plugin tag throws “unregistered tag”, which makes the output of the page rather irritating to debug. Like, I know that all the tags are unregistered I don’t need to be told about it constantly, I only want to see syntax and logic errors caused by my meddling, so I use Testing for that and only switch back to Debugging for short periods or if I can’t immediately find a bug and need the stack trace/line numbers.

I did consider a plugin smd_debug which added a public container tag like <txp:smd_debug level="0|1|2">. That would just manually alter the production status inside the container based on the chosen level. So if you wanted to silence output completely, wrap your entire Page template in it with level="0". But you could selectively open up stuff around bits you want to fully debug. Or put the debug tag inside privileged tags so it’s only shown to logged in users. I did hit some snags so didn’t continue development.

Any merit in considering such a txp:debug tag for core to fulfill this request instead of making a new production status or something?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2016-10-16 10:35:43

etc
Developer
Registered: 2010-11-11
Posts: 5,153
Website GitHub

Re: Output debug info only to logged-in users

Then it’s mostly the level of verbosity? Makes sense, but the site visitors do not need to see even these syntax error warnings, unless you are asking someone to help with debugging. So I would turn back to the initial proposal of a preference (off by default) to suppress all debug/testing output for unlogged visitors, rather than introducing a new status.

Offline

#8 2016-10-16 11:01:24

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: Output debug info only to logged-in users

etc wrote #302226:

suppress all debug/testing output for unlogged visitors.

+1

and also change the way of errors are injected into the html document, because injecte errors in top of document, before <!doctype> is sometimes not convenient and explode DOM.

Offline

#9 2016-10-16 11:45:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,434
Website GitHub

Re: Output debug info only to logged-in users

etc wrote #302226:

a preference (off by default) to suppress all debug/testing output for unlogged visitors

That works for me. Or, even, forget the pref and make that the default behaviour. No errors shown on front website, regardless of production status, unless you’re logged in, then you see whatever level of verbosity you’ve set according to production status? Or does that make it difficult for people to report site problems to admins?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2016-10-16 12:38:42

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,156
Website

Re: Output debug info only to logged-in users

Bloke wrote #302234:

Or does that make it difficult for people to report site problems to admins?

Someone may come to the forums with a cry for help, and an experienced user here might immediately see the problem / solution by viewing the page + debug / error code (without need to be a logged-in user).

I’m all in favour of Olegs proposal.

Also +1 on what Sacripant notes about appending those error thingies near the end of the page.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#11 2016-10-16 12:55:53

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Re: Output debug info only to logged-in users

It is not always possible to identify the user logged on(txp cookie). For example in the multisite installation is impossible. Therefore it is necessary to consider two options:
  • detect per txp cookie
  • detect per IP

We need to think, maybe it’s all you can do with plugin, so as not to overload txp core.


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

#12 2016-10-16 18:28:52

etc
Developer
Registered: 2010-11-11
Posts: 5,153
Website GitHub

Re: Output debug info only to logged-in users

makss wrote #302240:

It is not always possible to identify the user logged on(txp cookie). For example in the multisite installation is impossible.

We need to think, maybe it’s all you can do with plugin, so as not to overload txp core.

Valid points. Imo, it should be in core, but if we can not find a universal solution, I will wright myself a tiny mono-site plugin.

Offline

Board footer

Powered by FluxBB