Press "Enter" to skip to content

Simple And Easy jQuery Plugin To Highlight .NET Stack Effects | netStack.js

netStack.js is a simplified jQuery syntax that features a .NET plug-in that enables you to highlight exception information (stack trace) using your own CSS styles.

How to make use of it:

1. Insert your stack hint right into a <pre> or <code> tag.

<pre class="stacktrace">
ConsoleApplication1.MyCustomException: some message .... ---> System.Exception: Oh noes!
   at ConsoleApplication1.SomeObject.OtherMethod() in C:\ConsoleApplication1\SomeObject.cs:line 24
   at ConsoleApplication1.SomeObject..ctor() in C:\ConsoleApplication1\SomeObject.cs:line 14
   --- End of inner exception stack trace ---
   at ConsoleApplication1.SomeObject..ctor() in C:\ConsoleApplication1\SomeObject.cs:line 18
   at ConsoleApplication1.Program.DoSomething() in C:\ConsoleApplication1\Program.cs:line 23
   at ConsoleApplication1.Program.Main(String[] args) in C:\ConsoleApplication1\Program.cs:line 13
</pre>

2. Download and insert the jQuery webStack.js after the jQuery library.

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" 
        integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" 
        crossorigin="anonymous">
</script>
<script src="netStack.js"></script>

3. Initialize the plugin on the <pre> factor.

$('.stacktrace').netStack();

4. Apply your individual types to the highlighted strings.

pre, code {
  background-color: #222;
  color: #ffffff;
  font-family:'Roboto Mono'
}

.st-type {
  color: #0a8472;
  font-weight: bolder;
}

.st-method {
  color: #70c9ba;
  font-weight: bolder;
}

.st-frame-params {
  color: #ffffff;
  font-weight: normal;
}

.st-param-type { color: #0a8472; }

.st-param-name { color: #ffffff; }

.st-file { color: #f8b068; }

.st-line { color: #ff4f68; }

5. Default values for classes.

$('.stacktrace').netStack({
  frame: 'st-frame',
  type: 'st-type',
  method: 'st-method',
  paramsList: 'st-frame-params',
  paramType: 'st-param-type',
  paramName: 'st-param-name',
  file: 'st-file',
  line: 'st-line'
});

Highlight .NET Stack Trace In Exception, netStack.js Plugin/Github


See Demo And Download

Official Website(elmahio): Click Here

This superior jQuery/javascript plugin is developed by elmahio. For extra Advanced Usages, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.