Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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.
Online
Offline
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
Online
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
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.
Online
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
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
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
Re: Output debug info only to logged-in users
- 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
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.
Online