Jump to content

Tip: How I enable Tracy Debugger to be always be enabled for yourself only as a logged-in superuser


Recommended Posts

I wanted to share the way I enable Tracy Debugger for myself (a superuser) and myself only, only when logged in.  This is useful if there are other superusers that are not developers and you don't want them to see the Tracy Debugger bar.

There's a variety of settings and methods related to this, but I wanted to distill it into a few short steps:

  • create a permission called 'tracy-debugger' (note: Tracy Debugger doesn't create this permission for you during installation)
  • create a role called 'developer' (sounds like the right name to me)
  • assuming you're a superuser, edit your account and assign the 'developer' role; if there are multiple developers on the project, consider assigning them this role as well
  • in Tracy Debugger's settings do the following:
    • Main Setup → Output Mode → DEVELOPMENT
    • Access Permission → Restrict Superusers → checked
Link to comment
Share on other sites

Hi @Jonathan Lahijani - thanks for the write-up. You mention "myself only", so perhaps that's the reason for your approach - so other superusers don't have Tracy running in DEV mode? Is that the key functionality of this approach that you needed?

Otherwise, I think you might be confused about Tracy's DEVELOPMENT vs PRODUCTION modes. DEV mode is what enables the debug bar, while production mode runs Tracy in the background, logging and notifying errors (via email and / or Slack). It's not about whether your install is DEV or PROD. I just set to PROD mode and use the "Force superusers into DEVELOPMENT mode" option so that DEV mode is enabled for me (and other superusers) regardless of whether we are on the dev or prod servers.

 

Link to comment
Share on other sites

7 minutes ago, adrian said:

Hi @Jonathan Lahijani - thanks for the write-up. You mention "myself only", so perhaps that's the reason for your approach - so other superusers don't have Tracy running in DEV mode? Is that the key functionality of this approach that you needed?

That's correct.  I oftentimes have non-developers set as the Superuser role, but I wouldn't want them to see the Tracy Debugger bar.

Edit: I should reword my explanation as my usage of Development and Production is confusing within the context of Tracy Debugger.

Edited by Jonathan Lahijani
  • Like 1
Link to comment
Share on other sites

  • Jonathan Lahijani changed the title to Tip: How I enable Tracy Debugger to be always be enabled for yourself only as a logged-in superuser

@Jonathan Lahijani why don't you just use a separate config-local.php where you set guestForceDevelopmentLocal = true?

Such a dedicated config has a lot of other benefits like disabling sessionFingerprint to make sure you don't get logged out when you enable mobile view in devtools or filesOnDemand when using RockMigrations:

kOoraBm.png

Link to comment
Share on other sites

On 5/19/2023 at 12:56 AM, bernhard said:

@Jonathan Lahijani why don't you just use a separate config-local.php where you set guestForceDevelopmentLocal = true?

Such a dedicated config has a lot of other benefits like disabling sessionFingerprint to make sure you don't get logged out when you enable mobile view in devtools or filesOnDemand when using RockMigrations:

@bernhard My current strategy for detecting development/staging/production environment is currently based on using gethostname() or server_name, depending on the site and setting a custom $config->env variable.  Eventually I will switch to a cleaner way when Ryan hopefully officially implements something more formal.  I saw your PR and have read the various discussions on this topic.

That aside, I would still want guestForceDevelopmentLocal to apply specifically to myself (based on IP or some other method) because sometimes I let people view my local dev environment from the outside and I don't want them to see the debug bar.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...