Skip to content

Commit 28b99c4

Browse files
committed
Improved asp.net core sample
1 parent 4d8429e commit 28b99c4

File tree

3 files changed

+1941
-1425
lines changed

3 files changed

+1941
-1425
lines changed

samples/Elmah.Io.JavaScript.AspNetCore/Elmah.Io.JavaScript.AspNetCore/Pages/Index.cshtml

Lines changed: 4 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -4,99 +4,13 @@
44
ViewData["Title"] = "Home page";
55
}
66

7-
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
8-
<ol class="carousel-indicators">
9-
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
10-
<li data-target="#myCarousel" data-slide-to="1"></li>
11-
<li data-target="#myCarousel" data-slide-to="2"></li>
12-
</ol>
13-
<div class="carousel-inner" role="listbox">
14-
<div class="item active">
15-
<img src="~/images/banner1.svg" alt="ASP.NET" class="img-responsive" />
16-
<div class="carousel-caption" role="option">
17-
<p>
18-
Learn how to build ASP.NET apps that can run anywhere.
19-
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
20-
Learn More
21-
</a>
22-
</p>
23-
</div>
24-
</div>
25-
<div class="item">
26-
<img src="~/images/banner2.svg" alt="Visual Studio" class="img-responsive" />
27-
<div class="carousel-caption" role="option">
28-
<p>
29-
There are powerful new features in Visual Studio for building modern web apps.
30-
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
31-
Learn More
32-
</a>
33-
</p>
34-
</div>
35-
</div>
36-
<div class="item">
37-
<img src="~/images/banner3.svg" alt="Microsoft Azure" class="img-responsive" />
38-
<div class="carousel-caption" role="option">
39-
<p>
40-
Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.
41-
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
42-
Learn More
43-
</a>
44-
</p>
45-
</div>
46-
</div>
47-
</div>
48-
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
49-
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
50-
<span class="sr-only">Previous</span>
51-
</a>
52-
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
53-
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
54-
<span class="sr-only">Next</span>
55-
</a>
56-
</div>
57-
587
<div class="row">
598
<div class="col-md-3">
60-
<h2>Application uses</h2>
61-
<ul>
62-
<li>Sample pages using ASP.NET Core Razor Pages</li>
63-
<li>Theming using <a href="https://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
64-
</ul>
65-
</div>
66-
<div class="col-md-3">
67-
<h2>How to</h2>
68-
<ul>
69-
<li><a href="https://go.microsoft.com/fwlink/?linkid=852130">Working with Razor Pages.</a></li>
70-
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
71-
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
72-
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
73-
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
74-
</ul>
75-
</div>
76-
<div class="col-md-3">
77-
<h2>Overview</h2>
78-
<ul>
79-
<li><a href="https://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
80-
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
81-
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
82-
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
83-
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
84-
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
85-
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
86-
</ul>
9+
<h2>Log exceptions</h2>
10+
<button onclick="generateError()">Throw new error</button>
8711
</div>
8812
<div class="col-md-3">
89-
<h2>Run &amp; Deploy</h2>
90-
<ul>
91-
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
92-
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
93-
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure App Service</a></li>
94-
</ul>
13+
<h2>Breadcrumbs</h2>
14+
<button onclick="addBreadcrumb()">Add breadcrumb</button>
9515
</div>
9616
</div>
97-
98-
@section scripts {
99-
<script type="text/javascript">
100-
generateError();
101-
</script>
102-
}

samples/Elmah.Io.JavaScript.AspNetCore/Elmah.Io.JavaScript.AspNetCore/wwwroot/js/site.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22
// for details on configuring this project to bundle and minify static web assets.
33

44
// Write your Javascript code.
5-
new Elmahio({
5+
var logger = new Elmahio({
66
apiKey: 'API_KEY',
7-
logId: 'LOG_ID'
7+
logId: 'LOG_ID',
8+
debug: true,
9+
breadcrumbs: true
810
});
911

1012
function generateError() {
1113
throw new Error("This is a test error that goes into your log on elmah.io");
14+
}
15+
16+
function addBreadcrumb() {
17+
debugger;
18+
logger.addBreadcrumb("Information", "Log", "Something happened before the error");
1219
}

0 commit comments

Comments
 (0)