GithubHelp home page GithubHelp logo

How to customise Error Page ? about tracy HOT 21 CLOSED

nette avatar nette commented on August 28, 2024
How to customise Error Page ?

from tracy.

Comments (21)

mikerockett avatar mikerockett commented on August 28, 2024 3

I'd like to bring this back to life. I think that, at the very least, it should be possible to override the stylesheet definition. As an alternative, perhaps we could work on the blue screen included in the package itself.

In my honest opinion, the blue screen could do with a minimal/modern facelift. The red is quite peircing to the eye (for me, anyway), and system native fonts would look great. The idea of multiple 'skins' could very well be overkill, and so my thinking is just to improve its appearance in such a way that it's more comfortable.

Here's a screenshot of a stylesheet I worked on today:

pw_tracy_1

@dg, do you think this could be worked on?

from tracy.

dg avatar dg commented on August 28, 2024 2

I added Tracy\Debugger::getBlueScreen()->userCssFile Tracy\Debugger::$customCssFile to allow to add custom CSS file.

from tracy.

dg avatar dg commented on August 28, 2024 1

I've changed it yet to array $customCssFiles

from tracy.

fprochazka avatar fprochazka commented on August 28, 2024

@Sanjoy87 The error page that Tracy renders on fatal error or uncatched exception is only a last resort. Therefore it is as simple as possible and you cannot customize it.

You should do something similar to this

Tracy\Debugger::enable();

try {
    $myApplication->run();

} catch (\Exception $e) {
    if ( ! Tracy\Debugger::$productionMode) {
        throw $e;
    }

    Tracy\Debugger::log($e, 'error');
    $myApplication->renderErrorPage($e);
}

this should allow you to

  • always log exceptions in production mode
  • render your own custom pages
  • in development mode the bluescreen will render immediately without the need to check logs

from tracy.

hrach avatar hrach commented on August 28, 2024

@fprochazka if I understood it correctly, @Sanjoy87 was talking about blue-screen.

from tracy.

fprochazka avatar fprochazka commented on August 28, 2024

Oh, in that case, there are bluescreen panels that you can use for adding information.

For example rendering of SQL that caused the exception, used like this:

Nette\Diagnostics\Debugger::getBlueScreen()
    ->addPanel('Nette\Bridges\DatabaseTracy\ConnectionPanel::renderException');

But there is no way to customize bluescreen design at this point.

from tracy.

JanTvrdik avatar JanTvrdik commented on August 28, 2024

@Sanjoy87 This is how Nette Framework customizes Tracy for itself: https://github.com/dg/nette/blob/506b1e6e3470f31caa1e923528bcd1750e18b392/Nette/Bridges/Framework/TracyBridge.php

from tracy.

sanjoydesk avatar sanjoydesk commented on August 28, 2024

Thanks @fprochazka @hrach @JanTvrdik all of you for quick response. Tracy is really awesome project so far.

I can see we can do some small changes with blue screen object. Tracy is standalone component. In this case it should be more flexible to customize (Development mode) according to the project though it has various features in it.

No idea how much my comments are valid for this project but i found few features can be added.

For example -

In the right side bottom of the exception page it shows _"Tracy - Nette Framework"_. So if tracy integrated with any other framework or project then it should not display "Nette Framework".

Using blue screen object allow us to add panel to the exception page, but panel displays two times, first one top as top panel next one after Call Stack, what if developer require only the first panel ?
If we add html tag to first panel title it simply displaying it into the browser.

 $blueScreen->addPanel(function($e) {
     return array(
     'tab' => '<h1>My Framework </h1> ', // instead of My Framework
     'panel' => '<h1> <span style="color:blue">My Framework </span> </h1>'// Works
     );
 });

It will be really great if you please add feature to customise template with external stylesheet.

Why it is requiring all files inside tracy.php[https://github.com/nette/tracy/blob/master/src/tracy.php]? Since tracy is composer powered, everything can be autoloaded right. So that it will look much better.

Hope it helps.

Thanks

from tracy.

JanTvrdik avatar JanTvrdik commented on August 28, 2024

it shows "Tracy - Nette Framework".

You mean the tiny text in Tracy logo? That's unlikely to change.

what if developer require only the first panel?

That's that the parameter $e is for. You should return the array only if $e is NULL.

If we add html tag to first panel title it simply displaying it into the browser.

And that's OK. It's a panel title, it should not contain any HTML tags.

Why it is requiring all files inside tracy.php

Because Tracy is usable without Composer as well. If you use Composer, you'll never need to load this file.

from tracy.

sanjoydesk avatar sanjoydesk commented on August 28, 2024

Yes it make sense. thanks @JanTvrdik .

You mean the tiny text in Tracy logo? That's unlikely to change.

Cygnite Framerwork is under MIT license, hope it is not a problem to integrate Tracy with. It seems we need to code a bit to fit Tracy with our color schema.

You can see Laravel Framework uses Whoops Error handler which is similar to Tracy but Laravel does theme changes with external stylesheet and template customization.

We can add same feature into Tracy to make it much more flexible.

Is there any discussion chat room for Tracy, if possible let me know if we can chat, to know much more about it.

Thanks for your response. Great work!

from tracy.

mishak87 avatar mishak87 commented on August 28, 2024

I could understand if you needed dark version but rebranding it is just silly. Getting rid of obsessions about tools visual style is more helpful then creating one. Tracy has quite polished appearance. And as a tool for debugging hers purpose is not to look colourful.

Maybe it would be useful to have interface for main framework and its version instead of constant Nette Framework. But that is something for @dg to decide. For now you can show it by adding BarPanel.

from tracy.

dg avatar dg commented on August 28, 2024

To allow to create skins for Tracy is not a bad idea.

from tracy.

rostenkowski avatar rostenkowski commented on August 28, 2024

All included in the exception-...-log.html files?

from tracy.

sanjoydesk avatar sanjoydesk commented on August 28, 2024

from tracy.

adrianbj avatar adrianbj commented on August 28, 2024

I added Tracy\Debugger::getBlueScreen()->userCssFile to allow to add custom CSS file.

Thanks @dg this will be great!

Do you have any thoughts about adding similar options for the other css files as well?

bar.css
toggle.css
dumper.css

Currently I am overriding a lot of things in bar.css which mostly works great, but it's a bit hacky when it comes to loading my replacement css file when on the bluescreen page.

from tracy.

dg avatar dg commented on August 28, 2024

@mikerockett the red "bluescreen" is a distinguishing mark of Tracy and to change it would cause a negative reaction, which I really do not want.

(Btw, red was much more aggresive years ago :-) https://phpfashion.com/images/exception-ndebug.gif

It's possible to change the font to a system one, but I think nobody even noticed it, which makes me feel it is unnecessary.

from tracy.

dg avatar dg commented on August 28, 2024

@adrianbj So it would be better Tracy\Debugger::$userCssFile that will be loaded after BlueScreen's & Bar's default CSS files?

from tracy.

adrianbj avatar adrianbj commented on August 28, 2024

So it would be better Tracy\Debugger::$userCssFile that will be loaded after BlueScreen's & Bar's CSS files?

Yes, this might be better - overriding, rather than replacing means that even if you add more DOM elements and related CSS rules to Tracy in the future, we don't need to worry about keeping our custom user css files up to date.

Caveat - CSS is not my favorite thing in the world, so maybe there is an even better approach?

from tracy.

dg avatar dg commented on August 28, 2024

Ok, I repushed it.

from tracy.

mikerockett avatar mikerockett commented on August 28, 2024

@dg Thank you, this is awesome. I can agree with the red and how folks are used to it - I get that it could cause a negative reaction. That said, I think it's 'old-school', and not so friendly on the eyes (mine, anyway). Nonetheless, this makes it super-easy to fix. πŸ‘

from tracy.

adrianbj avatar adrianbj commented on August 28, 2024

Ok, I repushed it.

Thank you @dg - that is working really nicely :)

from tracy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.