Skip to content

Commit 555145e

Browse files
committed
Initial commit
0 parents  commit 555145e

32 files changed

+804
-0
lines changed

.appveyor.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '{build}'
2+
pull_requests:
3+
do_not_increment_build_number: true
4+
image: Visual Studio 2017
5+
nuget:
6+
disable_publish_on_pr: true
7+
build_script:
8+
- ps: .\build.ps1
9+
test: off
10+
init:
11+
- git config --global core.autocrlf input
12+
environment:
13+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
14+
DOTNET_CLI_TELEMETRY_OPTOUT: true
15+
CI: true
16+
artifacts:
17+
- path: .\src\Webenable.Logging.JavaScript\artifacts\**\*.nupkg
18+
name: NuGet

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[Oo]bj/
2+
[Bb]in/
3+
.nuget/
4+
packages/
5+
artifacts/
6+
pack/
7+
PublishProfiles/
8+
.vs/
9+
*.user
10+
*.suo
11+
*.userprefs
12+
*DS_Store
13+
.settings
14+
*.sln.ide
15+
.build/
16+
*.ldf

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: csharp
2+
mono: none
3+
dotnet: 2.1.502
4+
dist: trusty
5+
os:
6+
- linux
7+
- osx
8+
osx_image: xcode8.3
9+
before_script:
10+
- chmod +x ./build.sh
11+
script:
12+
- ./build.sh

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Webenable B.V., Henk Mollema
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Logging.JavaScript.sln

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26124.0
5+
MinimumVisualStudioVersion = 15.0.26124.0
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C7B8896D-99E5-433A-A8D0-C8C5961EA982}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Webenable.Logging.JavaScript", "src\Webenable.Logging.JavaScript\Webenable.Logging.JavaScript.csproj", "{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F36C0A04-540B-4C8B-9267-F066959B2FDC}"
11+
EndProject
12+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Webenable.Logging.JavaScript.Tests", "test\Webenable.Logging.JavaScript.Tests\Webenable.Logging.JavaScript.Tests.csproj", "{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}"
13+
EndProject
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Webenable.Logging.JavaScript.TestWebsite", "test\Webenable.Logging.JavaScript.TestWebsite\Webenable.Logging.JavaScript.TestWebsite.csproj", "{A1C282C6-AB7C-4875-8038-821719695669}"
15+
EndProject
16+
Global
17+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
18+
Debug|Any CPU = Debug|Any CPU
19+
Debug|x64 = Debug|x64
20+
Debug|x86 = Debug|x86
21+
Release|Any CPU = Release|Any CPU
22+
Release|x64 = Release|x64
23+
Release|x86 = Release|x86
24+
EndGlobalSection
25+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
26+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}.Debug|x64.ActiveCfg = Debug|Any CPU
29+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}.Debug|x64.Build.0 = Debug|Any CPU
30+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}.Debug|x86.ActiveCfg = Debug|Any CPU
31+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}.Debug|x86.Build.0 = Debug|Any CPU
32+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
33+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}.Release|Any CPU.Build.0 = Release|Any CPU
34+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}.Release|x64.ActiveCfg = Release|Any CPU
35+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}.Release|x64.Build.0 = Release|Any CPU
36+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}.Release|x86.ActiveCfg = Release|Any CPU
37+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7}.Release|x86.Build.0 = Release|Any CPU
38+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
40+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}.Debug|x64.ActiveCfg = Debug|Any CPU
41+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}.Debug|x64.Build.0 = Debug|Any CPU
42+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}.Debug|x86.ActiveCfg = Debug|Any CPU
43+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}.Debug|x86.Build.0 = Debug|Any CPU
44+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
45+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}.Release|Any CPU.Build.0 = Release|Any CPU
46+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}.Release|x64.ActiveCfg = Release|Any CPU
47+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}.Release|x64.Build.0 = Release|Any CPU
48+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}.Release|x86.ActiveCfg = Release|Any CPU
49+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA}.Release|x86.Build.0 = Release|Any CPU
50+
{A1C282C6-AB7C-4875-8038-821719695669}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51+
{A1C282C6-AB7C-4875-8038-821719695669}.Debug|Any CPU.Build.0 = Debug|Any CPU
52+
{A1C282C6-AB7C-4875-8038-821719695669}.Debug|x64.ActiveCfg = Debug|Any CPU
53+
{A1C282C6-AB7C-4875-8038-821719695669}.Debug|x64.Build.0 = Debug|Any CPU
54+
{A1C282C6-AB7C-4875-8038-821719695669}.Debug|x86.ActiveCfg = Debug|Any CPU
55+
{A1C282C6-AB7C-4875-8038-821719695669}.Debug|x86.Build.0 = Debug|Any CPU
56+
{A1C282C6-AB7C-4875-8038-821719695669}.Release|Any CPU.ActiveCfg = Release|Any CPU
57+
{A1C282C6-AB7C-4875-8038-821719695669}.Release|Any CPU.Build.0 = Release|Any CPU
58+
{A1C282C6-AB7C-4875-8038-821719695669}.Release|x64.ActiveCfg = Release|Any CPU
59+
{A1C282C6-AB7C-4875-8038-821719695669}.Release|x64.Build.0 = Release|Any CPU
60+
{A1C282C6-AB7C-4875-8038-821719695669}.Release|x86.ActiveCfg = Release|Any CPU
61+
{A1C282C6-AB7C-4875-8038-821719695669}.Release|x86.Build.0 = Release|Any CPU
62+
EndGlobalSection
63+
GlobalSection(SolutionProperties) = preSolution
64+
HideSolutionNode = FALSE
65+
EndGlobalSection
66+
GlobalSection(NestedProjects) = preSolution
67+
{8198E919-5BD0-4F63-8C4A-6A6EA6B750A7} = {C7B8896D-99E5-433A-A8D0-C8C5961EA982}
68+
{AC6D2A6D-181A-42E1-B326-D24926A7A6FA} = {F36C0A04-540B-4C8B-9267-F066959B2FDC}
69+
{A1C282C6-AB7C-4875-8038-821719695669} = {F36C0A04-540B-4C8B-9267-F066959B2FDC}
70+
EndGlobalSection
71+
GlobalSection(ExtensibilityGlobals) = postSolution
72+
SolutionGuid = {798FABA3-B660-4CD3-AF62-6F188C40DC78}
73+
EndGlobalSection
74+
EndGlobal

NuGet.Config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
5+
</packageSources>
6+
</configuration>

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# JavaScript Logging
2+
Forwards JavaScript logs to ASP.NET Core applications.
3+
4+
JavaScript Logging is a small library which forwards client-side JavaScript logging via `console.info`, `console.error`, etc. to the server and calls logs the message with the equivalent using the `ILogger` interface.
5+
6+
## Getting started
7+
8+
Install the package from NuGet:
9+
10+
```
11+
dotnet add package Webenable.Logging.JavaScript
12+
```
13+
14+
Configure the logging library in your Startup class:
15+
16+
```cs
17+
public void ConfigureServices(IServiceCollection services)
18+
{
19+
services.AddJavaScriptLogging();
20+
21+
// ...
22+
}
23+
```
24+
25+
The library will automatically inject the necessary JavaScript and register a middlware to handle the log HTTP requests.
26+
27+
## Dependencies
28+
The library uses jQuery to post log messages to the server using AJAX. Please make sure that jQuery is available when using this library.
29+
30+
## Using the library
31+
32+
Any calls to the following `console` methods are intercepted and will post a log message to the server which logs the message with the corresponding log level. The default behavior of the `console` method is executed as well.
33+
34+
- `console.trace`
35+
- `console.debug`
36+
- `console.info`
37+
- `console.warn`
38+
- `console.error`

build.cmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@ECHO OFF
2+
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE"

build.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dotnet restore
2+
dotnet build
3+
dotnet test .\test\Webenable.Logging.JavaScript.Tests
4+
dotnet pack .\src\Webenable.Logging.JavaScript -c Release -o .\artifacts

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dotnet build

0 commit comments

Comments
 (0)