ObjectDumper icon indicating copy to clipboard operation
ObjectDumper copied to clipboard

DumpStyle.HTML Dump Option

Open lawrencek76 opened this issue 5 years ago • 6 comments

I was looking at adding another dump format for html. Is that something you would be interested in bringing into ObjectDumper?

I'm looking to create simple html output that would be useful in debugging web apps / web app error pages. html formatted diagnostic email messages.

lawrencek76 avatar Jul 03 '19 22:07 lawrencek76

Can you make an example of how such an html message would look like?

thomasgalliker avatar Jul 04 '19 05:07 thomasgalliker

The primary output would be something like this for the example in the readme.

    <div class="obj-dump">
        <div class="obj-class-info">
            <span class="obj-label">Class Type:</span>
            <span
                class="obj-type-list-objectdumpersample-netfx-person">List&lt;ObjectDumperSample.Netfx.Person&gt;</span>
        </div>
        <table class="obj-type-list-objectdumpersample-netfx-person">
            <thead>
                <tr>
                    <th class="obj-type-string">Name</th>
                    <th class="obj-type-int">Age</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td class="obj-type-string">John</td>
                    <td class="obj-type-int">20</td>
                </tr>
                <tr>
                    <td class="obj-type-string">Thomas</td>
                    <td class="obj-type-int">30</td>
                </tr>
            <tbody>
        </table>
    </div>

Styling would be primarily left to the caller to add although it might be nice to have options for creating a full html document with some basic styling that generates something like this.

Capture

objDumperHtmlSample.txt

Of course there are lot of details to flesh out on this but I think that shows the general idea.

lawrencek76 avatar Jul 04 '19 14:07 lawrencek76

Yes why not integrating something like that. Kind of a report-style output. The thing is just: There will be people adking for different styles and formatting of the html output. Of course, we could build a highly flexible formatting logic but I think that would be a bit over the top, what do you think?

thomasgalliker avatar Jul 04 '19 15:07 thomasgalliker

Yea simple at least at first. Adding classes so most styling can be done on the users end. Not trying to go crazy with options and flexibility.

lawrencek76 avatar Jul 04 '19 15:07 lawrencek76

I'm sorry for not coming back to this in time. I saw you're working on branch lawrence-Html. Is this still on? Does it already work?

thomasgalliker avatar Aug 06 '19 05:08 thomasgalliker

Yea still on, Just vacation is over, back to work. It is working in the simple case of object with properties and looking at how to deal with the more interesting case of collections of objects and making a html table out of it with nesting and all that.

The branch also has some refactor of the "core" logic into the base class, that will probably be split off and done as a separate pr.

lawrencek76 avatar Aug 06 '19 13:08 lawrencek76