Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
39a7bd7
SerilogViewer: update to .NET6. Steps: (1) delete all the folder and …
Apr 26, 2022
b1de880
SerilogViewerSample: tried to update it from .NET Framework to .NET6
Apr 26, 2022
e0d74bd
SerilogViewerSample: add the UI according to the original code
Apr 26, 2022
f3fa65a
SerilogViewerSample: (1) fixed the namespace error of SerilogViewer (…
Apr 26, 2022
08078d2
SerilogViewerSample: add the conyent of MainWindow.xaml.cs
Apr 26, 2022
e963c41
set all the projects "build for windows10, support window7"
Apr 26, 2022
ced8e37
revert the platform to window7
Apr 26, 2022
afb6634
(1)add SerilogViewer_NET (copied from SerilogViewer) (2)add SerilogVi…
Apr 26, 2022
19bcfa4
rename the project name of "SerilogViewer_NET" and "SerilogViewerSamp…
Apr 26, 2022
c61ce65
SerilogViewer_NET: Fixed the assembly name
Apr 26, 2022
7093396
SerilogViewerSample_NET: fixed the dependency project
Apr 26, 2022
76f7f75
remove the SerilogViewer_NET and SerilogViewerSample_NET. The right w…
Apr 26, 2022
6b66ffe
remove "SerilogViewer_NET" and "SerilogViewerSample_NET" projects
Apr 19, 2023
e66a75c
remove windows version
Apr 19, 2023
bd32175
add NuGet package information
Apr 19, 2023
997de65
add: license and readme to the NuGet package
Apr 19, 2023
a0562a5
update version
Apr 19, 2023
6769d33
add my name to license
Apr 19, 2023
d0f610c
In order to upload to nuget.org: fix package id, use my own project url
Apr 19, 2023
432daa9
update the dependency "Serilog"
Apr 19, 2023
de067b5
update version
Apr 19, 2023
3987a84
degrade .NET 6 to .NET 5,so it can support .NET 5+
Apr 19, 2023
c1544ae
support .NET 6,7,8 directly
May 3, 2024
f9a9dad
I think colume SourceContext and Exception is useless
May 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ MIT License

Copyright (c) 2016 erizet
Copyright (c) 2019 codeaphex
Copyright (c) 2023 tanzi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
28 changes: 14 additions & 14 deletions SerilogViewer.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29411.108
# Visual Studio Version 17
VisualStudioVersion = 17.1.32407.343
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerilogViewerSample", "SerilogViewerSample\SerilogViewerSample.csproj", "{3FFEA19F-765F-426B-B25E-D2A448281878}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerilogViewer", "SerilogViewer\SerilogViewer.csproj", "{55C840BA-979C-4836-9483-C65D8390EB26}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7C1A6760-7375-4D65-BBFE-B84D0CE90384}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
Expand All @@ -16,20 +12,24 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.github\workflows\release_nuget_workflow.yaml = .github\workflows\release_nuget_workflow.yaml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SerilogViewer", "SerilogViewer\SerilogViewer.csproj", "{3236221A-7A3F-42D9-8333-010D24949DED}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SerilogViewerSample", "SerilogViewerSample\SerilogViewerSample.csproj", "{6F87F47C-9F71-4DB1-AFF7-89943190706F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3FFEA19F-765F-426B-B25E-D2A448281878}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3FFEA19F-765F-426B-B25E-D2A448281878}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3FFEA19F-765F-426B-B25E-D2A448281878}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3FFEA19F-765F-426B-B25E-D2A448281878}.Release|Any CPU.Build.0 = Release|Any CPU
{55C840BA-979C-4836-9483-C65D8390EB26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{55C840BA-979C-4836-9483-C65D8390EB26}.Debug|Any CPU.Build.0 = Debug|Any CPU
{55C840BA-979C-4836-9483-C65D8390EB26}.Release|Any CPU.ActiveCfg = Release|Any CPU
{55C840BA-979C-4836-9483-C65D8390EB26}.Release|Any CPU.Build.0 = Release|Any CPU
{3236221A-7A3F-42D9-8333-010D24949DED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3236221A-7A3F-42D9-8333-010D24949DED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3236221A-7A3F-42D9-8333-010D24949DED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3236221A-7A3F-42D9-8333-010D24949DED}.Release|Any CPU.Build.0 = Release|Any CPU
{6F87F47C-9F71-4DB1-AFF7-89943190706F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F87F47C-9F71-4DB1-AFF7-89943190706F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F87F47C-9F71-4DB1-AFF7-89943190706F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F87F47C-9F71-4DB1-AFF7-89943190706F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
10 changes: 10 additions & 0 deletions SerilogViewer/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
36 changes: 0 additions & 36 deletions SerilogViewer/Properties/AssemblyInfo.cs

This file was deleted.

96 changes: 23 additions & 73 deletions SerilogViewer/SerilogViewer.csproj
Original file line number Diff line number Diff line change
@@ -1,79 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{55C840BA-979C-4836-9483-C65D8390EB26}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SerilogViewer</RootNamespace>
<AssemblyName>SerilogViewer</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<TargetFrameworks>net6.0-windows;net7.0-windows;net8.0-windows;net4.6.2-windows</TargetFrameworks>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
<UseWPF>true</UseWPF>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<AssemblyVersion>1.0.1.2</AssemblyVersion>
<Version>$(AssemblyVersion)</Version>
<Description>SerilogViewer is a simple WPF-control to show Serilog-logs.</Description>
<PackageTags>Serilog;WPF;log</PackageTags>
<Authors>Tanzi;erizet;codeaphex</Authors>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageProjectUrl>https://github.com/xiaoxstz/SerilogViewer</PackageProjectUrl>
<PackageId>Tanzi.$(AssemblyName)</PackageId>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>codeaphex.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\packages\Serilog.2.9.0\lib\net45\Serilog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="LogEventViewModel.cs" />
<Compile Include="SerilogEvent.cs" />
<Compile Include="SerilogViewer.xaml.cs">
<DependentUpon>SerilogViewer.xaml</DependentUpon>
</Compile>
<Compile Include="SerilogViewerSink.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SerilogViewerSinkExtensions.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="SerilogViewer.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>

<ItemGroup>
<None Include="packages.config" />
<None Include="SerilogViewer.nuspec" />
<None Include="..\LICENSE.md" Link="LICENSE.md" Pack="true" PackagePath="\" />
<None Include="..\README.md" Link="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<Content Include="codeaphex.ico" />
<PackageReference Include="Serilog" Version="2.12.0" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

</Project>
21 changes: 0 additions & 21 deletions SerilogViewer/SerilogViewer.nuspec

This file was deleted.

4 changes: 2 additions & 2 deletions SerilogViewer/SerilogViewer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
<GridView>
<GridView.Columns>
<GridViewColumn DisplayMemberBinding="{Binding Time}" Header="Time" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type serilogViewer:SerilogViewer}}, Path=TimeWidth}"/>
<GridViewColumn DisplayMemberBinding="{Binding SourceContext}" Header="SourceContext" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type serilogViewer:SerilogViewer}}, Path=ContextWidth}"/>
<!--<GridViewColumn DisplayMemberBinding="{Binding SourceContext}" Header="SourceContext" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type serilogViewer:SerilogViewer}}, Path=ContextWidth}"/>-->
<GridViewColumn DisplayMemberBinding="{Binding Level}" Header="Level" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type serilogViewer:SerilogViewer}}, Path=LevelWidth}"/>
<GridViewColumn DisplayMemberBinding="{Binding FormattedMessage}" Header="Message" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type serilogViewer:SerilogViewer}}, Path=MessageWidth}"/>
<GridViewColumn DisplayMemberBinding="{Binding Exception}" Header="Exception" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type serilogViewer:SerilogViewer}}, Path=ExceptionWidth}"/>
<!--<GridViewColumn DisplayMemberBinding="{Binding Exception}" Header="Exception" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type serilogViewer:SerilogViewer}}, Path=ExceptionWidth}"/>-->
</GridView.Columns>
</GridView>
</ListView.View>
Expand Down
Binary file removed SerilogViewer/codeaphex.ico
Binary file not shown.
4 changes: 0 additions & 4 deletions SerilogViewer/packages.config

This file was deleted.

6 changes: 0 additions & 6 deletions SerilogViewerSample/App.config

This file was deleted.

1 change: 1 addition & 0 deletions SerilogViewerSample/App.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Application x:Class="SerilogViewerSample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SerilogViewerSample"
StartupUri="MainWindow.xaml">
<Application.Resources>

Expand Down
10 changes: 10 additions & 0 deletions SerilogViewerSample/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
39 changes: 21 additions & 18 deletions SerilogViewerSample/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<Window x:Class="SerilogViewerSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:serilogviewer="clr-namespace:SerilogViewer;assembly=SerilogViewer"
Title="SerilogViewer Sample">
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:serilogviewer ="clr-namespace:SerilogViewer;assembly=SerilogViewer"
xmlns:local="clr-namespace:SerilogViewerSample"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>

<GroupBox Grid.Row="0" Header="Send">
<StackPanel Orientation="Vertical">
<Label x:Name="lblLogText" Content="Text" />
Expand All @@ -22,29 +26,28 @@
<Button x:Name="btnError" Content="Error" Click="Send_Click" />
<CheckBox x:Name="cbWithContext" Content="add SourceContext" HorizontalAlignment="Left" VerticalAlignment ="Center"/>
</StackPanel>
</StackPanel>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="1" Header="Functions">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Button x:Name="btnClear" Content="Clear" Click="Clear_Click" />
<Button Content="Scroll Top" Click="TopScroll_Click" />
<Button Content="Scroll Bottom" Click="BottomScroll_Click" />
<CheckBox x:Name="cbAutoScroll" Content="Scroll To Last" HorizontalAlignment="Left" VerticalAlignment ="Center" Checked="AutoScroll_Checked" Unchecked="AutoScroll_Unchecked"/>
<GroupBox Grid.Row="1" Header="Functions">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Button x:Name="btnClear" Content="Clear" Click="Clear_Click" />
<Button Content="Scroll Top" Click="TopScroll_Click" />
<Button Content="Scroll Bottom" Click="BottomScroll_Click" />
<CheckBox x:Name="cbAutoScroll" Content="Scroll To Last" HorizontalAlignment="Left" VerticalAlignment ="Center" Checked="AutoScroll_Checked" Unchecked="AutoScroll_Unchecked"/>
</StackPanel>
</StackPanel>
</StackPanel>
</GroupBox>
</GroupBox>

<GroupBox Grid.Row="2" Header="Autosending">
<GroupBox Grid.Row="2" Header="Autosending">
<StackPanel Orientation="Vertical">
<CheckBox x:Name="chkBackgroundSending" Content="Send logs from background thread." Checked="BackgroundSending_Checked" IsChecked="False" Unchecked="BackgroundSending_Unchecked" />
</StackPanel>
</GroupBox>


<GroupBox Grid.Row="3" Header="SerilogViewer">
<serilogviewer:SerilogViewer x:Name="logCtrl" TimeWidth="auto" ContextWidth="auto" LevelWidth="auto" ExceptionWidth="auto" MessageWidth="auto" />
<serilogviewer:SerilogViewer x:Name="logCtrl" TimeWidth="auto" ContextWidth="auto" LevelWidth="auto" ExceptionWidth="auto" MessageWidth="auto" />
</GroupBox>

</Grid>
</Window>
23 changes: 10 additions & 13 deletions SerilogViewerSample/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace SerilogViewerSample
{

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
Expand Down Expand Up @@ -44,7 +43,7 @@ private void Send_Click(object sender, RoutedEventArgs e)
{
log.ForContext<MainWindow>().Write(level, tbLogText.Text);
}
else
else
{
log.Write(level, tbLogText.Text);
}
Expand All @@ -60,21 +59,21 @@ private void SendWithContext_Click(object sender, RoutedEventArgs e)
log.ForContext<MainWindow>().Write(level, tbLogText.Text);
}

private void OnLogMessageItemAdded(object o, EventArgs Args )
{
// Do what you want :)
LogEvent logEvent = (SerilogEvent)Args;
if( logEvent.Level >= LogEventLevel.Error)
SystemSounds.Beep.Play();
}
private void OnLogMessageItemAdded(object o, EventArgs Args)
{
// Do what you want :)
LogEvent logEvent = (SerilogEvent)Args;
if (logEvent.Level >= LogEventLevel.Error)
SystemSounds.Beep.Play();
}

private void Clear_Click(object sender, RoutedEventArgs e)
{
logCtrl.Clear();
logCtrl.Clear();
}
private void TopScroll_Click(object sender, RoutedEventArgs e)
{
logCtrl.ScrollToFirst();
logCtrl.ScrollToFirst();
}
private void BottomScroll_Click(object sender, RoutedEventArgs e)
{
Expand Down Expand Up @@ -121,7 +120,5 @@ private void SendLogs(object obj)

backgroundLogger.Debug("Backgroundtask stopped.");
}


}
}
Loading