From c3dc123527086abba380f1c327a89cd97e913562 Mon Sep 17 00:00:00 2001 From: TommySalami Date: Tue, 29 Jul 2025 12:48:00 -0600 Subject: [PATCH] Add project files. --- .gitattributes | 63 +++ .gitignore | 366 ++++++++++++++++++ CHANGELOG.md | 16 + CODE_OF_CONDUCT.md | 127 ++++++ CONTRIBUTING.md | 24 ++ LICENSE | 38 ++ README.md | 72 ++++ Serilog.Sinks.LogEmAll.sln | 36 ++ Serilog.Sinks.LogEmAll/ListStringLog.cs | 36 ++ .../ListStringLogExtensions.cs | 22 ++ .../ListStringLogInternal.cs | 81 ++++ .../Properties/AssemblyInfo.cs | 36 ++ Serilog.Sinks.LogEmAll/Resources/icon.png | Bin 0 -> 1457 bytes .../RichTextBoxLog.Designer.cs | 37 ++ Serilog.Sinks.LogEmAll/RichTextBoxLog.cs | 51 +++ .../RichTextBoxLogExtensions.cs | 22 ++ .../RichTextBoxLogInternal.cs | 83 ++++ .../Serilog.Sinks.LogEmAll.csproj | 82 ++++ .../Serilog.Sinks.LogEmAll.nuspec | 30 ++ Serilog.Sinks.LogEmAll/packages.config | 4 + TODO.md | 5 + 21 files changed, 1231 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 Serilog.Sinks.LogEmAll.sln create mode 100644 Serilog.Sinks.LogEmAll/ListStringLog.cs create mode 100644 Serilog.Sinks.LogEmAll/ListStringLogExtensions.cs create mode 100644 Serilog.Sinks.LogEmAll/ListStringLogInternal.cs create mode 100644 Serilog.Sinks.LogEmAll/Properties/AssemblyInfo.cs create mode 100644 Serilog.Sinks.LogEmAll/Resources/icon.png create mode 100644 Serilog.Sinks.LogEmAll/RichTextBoxLog.Designer.cs create mode 100644 Serilog.Sinks.LogEmAll/RichTextBoxLog.cs create mode 100644 Serilog.Sinks.LogEmAll/RichTextBoxLogExtensions.cs create mode 100644 Serilog.Sinks.LogEmAll/RichTextBoxLogInternal.cs create mode 100644 Serilog.Sinks.LogEmAll/Serilog.Sinks.LogEmAll.csproj create mode 100644 Serilog.Sinks.LogEmAll/Serilog.Sinks.LogEmAll.nuspec create mode 100644 Serilog.Sinks.LogEmAll/packages.config create mode 100644 TODO.md diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5d801b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,366 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Oo]ut/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# Extra misc solution files +misc/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c755254 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +Version 0.0.8 - 2025-07-29 + +* Update repository info and related URLs +* Minor changes + +Version 0.0.7 - 2024-09-01 + +* Update readme + +Version 0.0.6 - 2024-09-01 + +* Update repo url + +Version 0.0.5 - 2023-04-08 + +* Update using .NET Framework 4.6.1 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..41dd9eb --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,127 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..fabf58c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,24 @@ +# @Serilog.Sinks.LogEmAll +### The Original LogEmAll Logger +## Contributing +Let's work better together. We are looking to collaborate with like-minded people who want to contribute in any capacity. Collaboration is open to everyone and we need your help if you are a: +* Collector +* Database Administrator +* Datter +* Developer +* Dumper +* Graphic Artist +* Translator +* Player +* Tester + +Feel free to: +* Fork the repository +* Create an issue +* Branch your repository with the issue number and a meaningful name related to the changes you are making +* Create a pull request +## Contact +GitEmAll: [https://gitemall.devemall.int.eu.org/TommySalami/Serilog.Sinks.LogEmAll](https://gitemall.devemall.int.eu.org/TommySalami/Serilog.Sinks.LogEmAll "GitEmAll") +## Disclaimer +This software may only be used and/or distributed in accordance with the license with which it is distributed. +###### Copyright (c) 2016-2025 LogEmAll - All Rights Reserved v2025-07-29-00 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1feed01 --- /dev/null +++ b/LICENSE @@ -0,0 +1,38 @@ +*************************************************************** +Serilog.Sinks.LogEmAll - License version 20250729 +Copyright (c) 2000-2025 LogEmAll - All Rights Reserved +*************************************************************** + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Redistributions in any form are not permitted whatsoever, + under any conditions. + +2. This software may not be reverse engineered, decompiled, + or disassembled. + +3. LogEmAll may publish revised and/or new + versions of the license from time to time. Each version + will be given a distinguishing version number. No one other + than LogEmAll has the right to modify the terms + applicable to covered code created under this License. + +4. It is your responsibility to use this software in accordance + with all applicable laws. + +*************************************************************** + +THIS SOFTWARE IS PROVIDED BY THE LOGEMALL +DEVELOPMENT TEAM 'AS IS' AND ANY EXPRESSED OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +LOGEMALL DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..aaa40de --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +# @Serilog.Sinks.LogEmAll +### The Original LogEmAll Logger +## About +LogEmAll or LEA writes Serilog events to a List<String> or a Windows Forms Application RichTextBox control from anywhere in your application. +## Dependencies +The following NuGet Packages are required to build a Debug and/or Release version of this library: +* Serilog +## Getting started +To use the LogEmAll sink, + +First install the Serilog NuGet package to your solution projects. + +Second, install the Serilog.Sinks.LogEmAll NuGet Package to your solution projects. + +Third, add the relevent `using` statements to the top of your code where you want to use the logger, like the following: +``` +using Serilog; +using Serilog.Sinks.LogEmAll; +``` +Fourth, enable a sink in your program, using `WriteTo.RichTextBoxLog()` or `WriteTo.ListStringLog()` like the following: +``` +Log.Logger = new LoggerConfiguration() +.WriteToRichTextBox() +.WriteToListString() +.CreateLogger(); +``` +Optionally, you may format your logger, using `ITextFormatter` like the following: +``` +Log.Logger = new LoggerConfiguration() +.WriteToRichTextBox(new MessageTemplateTextFormatter("[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}")) +.WriteToListString(new MessageTemplateTextFormatter("[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{Exception}")) +.CreateLogger(); +``` +Fifth, create an instance of a sink in your code by dragging a `RichTextBoxLog` onto your GUI Design View or by adding a `ListStringLog` in your class like the following: +``` +static private ListStringLog _logList = new ListStringLog(); +static public ListStringLog LogList +{ + get { return _logList; } + set { _logList = value; } +} +``` +Sixth, use the `Log` anywhere in your code like the following: +``` +Log.Debug("This is debug information!"); +Log.Information("Hello, world!"); +Log.Warning("This is a warning!"); +Log.Error("An ERROR has occurred!"); +``` +Log events will be printed to your `RichTextBoxLog` or saved to your `ListStringLog`. +## Contributing +Let's work better together. We are looking to collaborate with like-minded people who want to contribute in any capacity. Collaboration is open to everyone and we need your help if you are a: +* Collector +* Database Administrator +* Datter +* Developer +* Dumper +* Graphic Artist +* Translator +* Player +* Tester + +Feel free to: +* Fork the repository +* Create an issue +* Branch your repository with the issue number and a meaningful name related to the changes you are making +* Create a pull request +## Contact +GitEmAll: [https://gitemall.devemall.int.eu.org/TommySalami/Serilog.Sinks.LogEmAll](https://gitemall.devemall.int.eu.org/TommySalami/Serilog.Sinks.LogEmAll "GitEmAll") +## Disclaimer +This software may only be used and/or distributed in accordance with the license with which it is distributed. +###### Copyright (c) 2016-2025 LogEmAll - All Rights Reserved v2025-07-29-00 diff --git a/Serilog.Sinks.LogEmAll.sln b/Serilog.Sinks.LogEmAll.sln new file mode 100644 index 0000000..9a36c67 --- /dev/null +++ b/Serilog.Sinks.LogEmAll.sln @@ -0,0 +1,36 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35013.160 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.LogEmAll", "Serilog.Sinks.LogEmAll\Serilog.Sinks.LogEmAll.csproj", "{1EF874F5-0837-444B-A8EE-3862EB936BCB}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CC17EF7E-D97F-4192-89B0-B6461C420368}" + ProjectSection(SolutionItems) = preProject + CHANGELOG.md = CHANGELOG.md + CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md + CONTRIBUTING.md = CONTRIBUTING.md + LICENSE = LICENSE + README.md = README.md + TODO.md = TODO.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + Description = The Original LogEmAll Logger + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1EF874F5-0837-444B-A8EE-3862EB936BCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1EF874F5-0837-444B-A8EE-3862EB936BCB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1EF874F5-0837-444B-A8EE-3862EB936BCB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1EF874F5-0837-444B-A8EE-3862EB936BCB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {446F1FEC-6B77-4A8B-8646-D94C2E3BE73B} + EndGlobalSection +EndGlobal diff --git a/Serilog.Sinks.LogEmAll/ListStringLog.cs b/Serilog.Sinks.LogEmAll/ListStringLog.cs new file mode 100644 index 0000000..c9caad4 --- /dev/null +++ b/Serilog.Sinks.LogEmAll/ListStringLog.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; + +namespace Serilog.Sinks.LogEmAll +{ + /// + /// ListStringLog class + /// + public partial class ListStringLog : List + { + #region Constructors + + /// + /// Constructor + /// + public ListStringLog() + { + ListStringLogSink.ListStringSink.OnLogReceived += ListStringSinkOnLogReceived; + } + + #endregion + + #region ListStringSink + + /// + /// Outputs a text string to the List String Sink log. + /// + /// + private void ListStringSinkOnLogReceived(string strMsg) + { + // Add the line of text to the log. + this.Add(strMsg); + } + + #endregion + } +} diff --git a/Serilog.Sinks.LogEmAll/ListStringLogExtensions.cs b/Serilog.Sinks.LogEmAll/ListStringLogExtensions.cs new file mode 100644 index 0000000..7f53ae6 --- /dev/null +++ b/Serilog.Sinks.LogEmAll/ListStringLogExtensions.cs @@ -0,0 +1,22 @@ +using Serilog; +using Serilog.Formatting; + +namespace Serilog.Sinks.LogEmAll +{ + /// + /// ListStringLogExtensions class + /// + public static class ListStringLogExtensions + { + /// + /// Write the simple formatted text logs directly to the List String. This List String control can be used from the toolbox. + /// + /// + /// + /// + public static LoggerConfiguration WriteToListString(this LoggerConfiguration configuration, ITextFormatter formatter = null) + { + return configuration.WriteTo.Sink(ListStringLogSink.MakeListStringSink(formatter)); + } + } +} diff --git a/Serilog.Sinks.LogEmAll/ListStringLogInternal.cs b/Serilog.Sinks.LogEmAll/ListStringLogInternal.cs new file mode 100644 index 0000000..9631cc0 --- /dev/null +++ b/Serilog.Sinks.LogEmAll/ListStringLogInternal.cs @@ -0,0 +1,81 @@ +using System; +using System.IO; +using Serilog.Core; +using Serilog.Events; +using Serilog.Formatting; +using Serilog.Formatting.Display; + +namespace Serilog.Sinks.LogEmAll +{ + /// + /// ListStringLogInternal class + /// + public class ListStringLogInternal : ILogEventSink + { + /// Private member variable + private ITextFormatter _textFormatter; + /// + public delegate void LogHandler(string str); + /// + public event LogHandler OnLogReceived; + + /// + /// Constructor + /// + /// + public ListStringLogInternal(ITextFormatter textFormatter) + { + _textFormatter = textFormatter; + } + + /// + /// Emit + /// + /// + public void Emit(LogEvent logEvent) + { + if (logEvent == null) throw new ArgumentNullException(nameof(logEvent)); + + if (_textFormatter == null) { throw new ArgumentNullException("Missing Log Formatter"); } + + var renderSpace = new StringWriter(); + _textFormatter.Format(logEvent, renderSpace); + + FireEvent(renderSpace.ToString()); + } + + /// + /// Fire Event + /// + /// + private void FireEvent(string str) + { + OnLogReceived?.Invoke(str); + } + } + + /// + /// ListStringLogSink class. + /// + public static class ListStringLogSink + { + /// + private static ListStringLogInternal _listStringSink = new ListStringLogInternal(new MessageTemplateTextFormatter("{Timestamp} [{Level}] {Message} {Exception}")); + /// + public static ListStringLogInternal ListStringSink => _listStringSink; + + /// + /// MakeListStringSink + /// + /// + /// + public static ListStringLogInternal MakeListStringSink(ITextFormatter formatter = null) + { + if (formatter == null) { formatter = new MessageTemplateTextFormatter("{Timestamp} [{Level}] {Message} {Exception}"); } + + _listStringSink = new ListStringLogInternal(formatter); + + return _listStringSink; + } + } +} diff --git a/Serilog.Sinks.LogEmAll/Properties/AssemblyInfo.cs b/Serilog.Sinks.LogEmAll/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c392be1 --- /dev/null +++ b/Serilog.Sinks.LogEmAll/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Serilog.Sinks.LogEmAll")] +[assembly: AssemblyDescription("The Original LogEmAll Logger")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("LogEmAll")] +[assembly: AssemblyProduct("Serilog.Sinks.LogEmAll")] +[assembly: AssemblyCopyright("Copyright (c) 2020-2025 LogEmAll - All Rights Reserved")] +[assembly: AssemblyTrademark("LogEmAll - The Original LogEmAll Logger")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1ef874f5-0837-444b-a8ee-3862eb936bcb")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.0.8")] +[assembly: AssemblyFileVersion("0.0.8")] diff --git a/Serilog.Sinks.LogEmAll/Resources/icon.png b/Serilog.Sinks.LogEmAll/Resources/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c202c5aa4524b8c0bc14815ecbfe7addbeac1d0c GIT binary patch literal 1457 zcmV;i1y1^jP)975Ip9AQJuoSt*#G}vDMKJ@HBcx5Ab?nYe*4uAWQc$i za4<6gF(Wp;6a$!j6o7yK+9QKnHc{5hPaZDY5#x* z0TILRzl5F2&cevR%)|(G0FcSR0(8I^AOn9`xegP#wGy~KDe?hJU8vgqqFl2yYUw|6K_}CcA z+?2tVgTUt>zlln%KY@1q{_%%_iG_*bAJ_r^;0^!?AQlh*{5gG*kRlc76UjX_a_6K?R|KY!t&g%7;_@{{4k$8QXRoU9BSEKFcMAdiDW4_mR$6p3@NgjrY(OL{Lf*dGi%-=u%h{~?NfB#|l3`_&R z|NH@`13oquhTp(M_zM`i00G4E6Bs`r2fPMa{^RdIu#dqR25Py!JU_#LaS+Qv zije_``yCj4L^%K$svvuq8UBN9`1bn`+%|v!V)^y^FGhI^O7oyRD=)&qFl*mEtcA^Q zpaWTf@yW`}NR$IW_Ap_oBme@4<=3CT7zHNCLU|D`hQ<(W1~wKPc?@U<8!-Pd5)lG_ zfKm1H4=Az!$EYL#0*K`|76*U|8<052a&{Ibit7PTXo1oJ3nOMN1rR`39q=2P4Pnv# z6_{er-G4{4g&=*pviuA}JdlL@_wQe@hai4IbpSvBv0zKb|Gp(lRnY>_RmcAb?o@Fk*KAviR%IzZjODe2lZ@g^}uki6GEOia`mO zlfY?!0pg)QSV90GfUr8?A0rcr1K5GtO0kFIWnu(dE0Ro8SKb8<+Kud&_0Jgj2Z?1AvMa+ zztrg?fyx9>{Qt-7*8v0&C=p%+(k2*59OQE@CI+ek%n*125J12d1!FM~e?rMB^ud2X zb^`8|o00000 LNkvXXu0mjf@%U!q literal 0 HcmV?d00001 diff --git a/Serilog.Sinks.LogEmAll/RichTextBoxLog.Designer.cs b/Serilog.Sinks.LogEmAll/RichTextBoxLog.Designer.cs new file mode 100644 index 0000000..750ff11 --- /dev/null +++ b/Serilog.Sinks.LogEmAll/RichTextBoxLog.Designer.cs @@ -0,0 +1,37 @@ + +namespace Serilog.Sinks.LogEmAll +{ + partial class RichTextBoxLog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/Serilog.Sinks.LogEmAll/RichTextBoxLog.cs b/Serilog.Sinks.LogEmAll/RichTextBoxLog.cs new file mode 100644 index 0000000..6789091 --- /dev/null +++ b/Serilog.Sinks.LogEmAll/RichTextBoxLog.cs @@ -0,0 +1,51 @@ +using System.Windows.Forms; + +namespace Serilog.Sinks.LogEmAll +{ + /// + /// RichTextBoxLog class + /// + public partial class RichTextBoxLog : RichTextBox + { + #region Constructors + + /// + /// Constructor + /// + public RichTextBoxLog() + { + InitializeComponent(); + RichTextBoxLogSink.RichTextBoxSink.OnLogReceived += RichTextBoxSinkOnLogReceived; + } + + #endregion + + #region RichTextBoxSink + + /// + /// Outputs a text string to the RichTextBox Sink log. + /// + /// + private void RichTextBoxSinkOnLogReceived(string strMsg) + { + if (this.InvokeRequired) + { + this.Invoke( + (MethodInvoker)delegate + { + this.AppendText(strMsg); + this.ScrollToCaret(); + }); + } + else + { + this.AppendText(strMsg); + this.ScrollToCaret(); + } + + Application.DoEvents(); + } + + #endregion + } +} diff --git a/Serilog.Sinks.LogEmAll/RichTextBoxLogExtensions.cs b/Serilog.Sinks.LogEmAll/RichTextBoxLogExtensions.cs new file mode 100644 index 0000000..1e01e21 --- /dev/null +++ b/Serilog.Sinks.LogEmAll/RichTextBoxLogExtensions.cs @@ -0,0 +1,22 @@ +using Serilog; +using Serilog.Formatting; + +namespace Serilog.Sinks.LogEmAll +{ + /// + /// RichTextBoxSinkExtensions class + /// + public static class RichTextBoxSinkExtensions + { + /// + /// Write the simple formatted text logs directly to the RichTextBox. This simple RichTextBox control can be used from the toolbox. + /// + /// + /// + /// + public static LoggerConfiguration WriteToRichTextBox(this LoggerConfiguration configuration, ITextFormatter formatter = null) + { + return configuration.WriteTo.Sink(RichTextBoxLogSink.MakeRichTextBoxSink(formatter)); + } + } +} diff --git a/Serilog.Sinks.LogEmAll/RichTextBoxLogInternal.cs b/Serilog.Sinks.LogEmAll/RichTextBoxLogInternal.cs new file mode 100644 index 0000000..cd9e5bd --- /dev/null +++ b/Serilog.Sinks.LogEmAll/RichTextBoxLogInternal.cs @@ -0,0 +1,83 @@ +using System; +using System.IO; +using Serilog.Core; +using Serilog.Events; +using Serilog.Formatting; +using Serilog.Formatting.Display; + +namespace Serilog.Sinks.LogEmAll +{ + /// + /// RichTextBoxLogInternal class + /// + public class RichTextBoxLogInternal : ILogEventSink + { + /// Private member variable + private ITextFormatter _textFormatter; + + /// + public delegate void LogHandler(string str); + + /// + public event LogHandler OnLogReceived; + + /// + /// Constructor + /// + /// + public RichTextBoxLogInternal(ITextFormatter textFormatter) + { + _textFormatter = textFormatter; + } + + /// + /// Emit + /// + /// + public void Emit(LogEvent logEvent) + { + if (logEvent == null) throw new ArgumentNullException(nameof(logEvent)); + + if (_textFormatter == null) { throw new ArgumentNullException("Missing Log Formatter"); } + + var renderSpace = new StringWriter(); + _textFormatter.Format(logEvent, renderSpace); + + FireEvent(renderSpace.ToString()); + } + + /// + /// Fire Event + /// + /// + private void FireEvent(string str) + { + OnLogReceived?.Invoke(str); + } + } + + /// + /// RichTextBoxLogSink class. + /// + public static class RichTextBoxLogSink + { + /// + private static RichTextBoxLogInternal _richTextBoxSink = new RichTextBoxLogInternal(new MessageTemplateTextFormatter("{Timestamp} [{Level}] {Message} {Exception}")); + /// + public static RichTextBoxLogInternal RichTextBoxSink => _richTextBoxSink; + + /// + /// MakeRichTextBoxSink + /// + /// + /// + public static RichTextBoxLogInternal MakeRichTextBoxSink(ITextFormatter formatter = null) + { + if (formatter == null) { formatter = new MessageTemplateTextFormatter("{Timestamp} [{Level}] {Message} {Exception}"); } + + _richTextBoxSink = new RichTextBoxLogInternal(formatter); + + return _richTextBoxSink; + } + } +} diff --git a/Serilog.Sinks.LogEmAll/Serilog.Sinks.LogEmAll.csproj b/Serilog.Sinks.LogEmAll/Serilog.Sinks.LogEmAll.csproj new file mode 100644 index 0000000..ff63e02 --- /dev/null +++ b/Serilog.Sinks.LogEmAll/Serilog.Sinks.LogEmAll.csproj @@ -0,0 +1,82 @@ + + + + + Debug + AnyCPU + {1EF874F5-0837-444B-A8EE-3862EB936BCB} + Library + Properties + Serilog.Sinks.LogEmAll + Serilog.Sinks.LogEmAll + v4.6.1 + 512 + true + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + bin\Debug\Serilog.Sinks.LogEmAll.xml + + + none + true + bin\Release\ + TRACE + prompt + 4 + bin\Release\Serilog.Sinks.LogEmAll.xml + + + + + + + + ..\packages\Serilog.2.12.0\lib\net46\Serilog.dll + + + + + + + + + + + + + + + + + + + Component + + + RichTextBoxLog.cs + + + + + + + + + + + + + + + nuget pack "$(ProjectPath)" -Prop Configuration=$(ConfigurationName) + + + \ No newline at end of file diff --git a/Serilog.Sinks.LogEmAll/Serilog.Sinks.LogEmAll.nuspec b/Serilog.Sinks.LogEmAll/Serilog.Sinks.LogEmAll.nuspec new file mode 100644 index 0000000..a95af45 --- /dev/null +++ b/Serilog.Sinks.LogEmAll/Serilog.Sinks.LogEmAll.nuspec @@ -0,0 +1,30 @@ + + + + Serilog.Sinks.LogEmAll + Serilog.Sinks.LogEmAll + 0.0.8 + Use the LogEmAll Library (.dll) to write Serilog events to a List<String> or a Windows Forms Application RichTextBox control from anywhere in your application. + + Install or add the LogEmAll Nuget Package to your application by downloading the [nuget.nupkg](https://gitemall.devemall.int.eu.org/TommySalami/Serilog.Sinks.LogEmAll/packages) to your project folder and opening a Nuget Package Manager Console in Visual Studio and type: + + ``` + Install-Package nuget.nupkg + ``` + + LogEmAll + LICENSE + false + icon.png + https://gitemall.devemall.int.eu.org/TommySalami/Serilog.Sinks.LogEmAll/src/branch/master/Serilog.Sinks.LogEmAll/Resources/Icon.png + https://gitemall.devemall.int.eu.org/TommySalami/Serilog.Sinks.LogEmAll + See https://gitemall.devemall.int.eu.org/TommySalami/Serilog.Sinks.LogEmAll/releases for release notes. + Copyright (c) 2016-2025 LogEmAll - All Rights Reserved + Serilog Sinks LogEmAll Sink Logs Log WinForms SerilogSink SerilogSinksLogEmAll Windows Forms Application Console RichTextBox RichTextBoxLog ListStringLog Logger + + + + + + + \ No newline at end of file diff --git a/Serilog.Sinks.LogEmAll/packages.config b/Serilog.Sinks.LogEmAll/packages.config new file mode 100644 index 0000000..3eea4b4 --- /dev/null +++ b/Serilog.Sinks.LogEmAll/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..a38578c --- /dev/null +++ b/TODO.md @@ -0,0 +1,5 @@ +### To Do +* Nothing to do + +### Completed Tasks +* Develop initial release