-
-
Notifications
You must be signed in to change notification settings - Fork 6
first iter #463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
first iter #463
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # Just later | ||
|
|
||
| ## Latest Update : 2026-04-02 => 02 April 2026 | ||
| ## Latest Update : 2026-04-03 => 03 April 2026 | ||
|
|
||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
|
|
||
| { | ||
| "$schema": "https://aka.ms/codetour-schema", | ||
| "title": "NLog.Extensions.ThisClass", | ||
| "steps": | ||
| [ | ||
| { | ||
| "file": "rscg_examples/NLog.Extensions.ThisClass/src/LogDemo/LogDemo.csproj", | ||
| "description": "First, we add Nuget [NLog.Extensions.ThisClass](https://www.nuget.org/packages/NLog.Extensions.ThisClass/) in csproj ", | ||
| "pattern": "NLog.Extensions.ThisClass" | ||
| } | ||
|
|
||
| ,{ | ||
| "file": "rscg_examples/NLog.Extensions.ThisClass/src/LogDemo/Person.cs", | ||
| "description": "File Person.cs ", | ||
| "pattern": "this is the code" | ||
| } | ||
|
|
||
| ,{ | ||
| "file": "rscg_examples/NLog.Extensions.ThisClass/src/LogDemo/Program.cs", | ||
| "description": "File Program.cs \r\n>> dotnet run --project rscg_examples/NLog.Extensions.ThisClass/src/LogDemo/LogDemo.csproj ", | ||
| "pattern": "this is the code" | ||
| } | ||
|
|
||
|
|
||
| ,{ | ||
| "file": "rscg_examples/NLog.Extensions.ThisClass/src/LogDemo/obj/GX/NLog.Extensions.ThisClass/NLog.Extensions.ThisClass.ThisClassNLogGenerator/Person_ClassLoggerLazy.g.cs", | ||
| "description": "Generated File 3 from 3 : Person_ClassLoggerLazy.g.cs ", | ||
| "line": 1 | ||
| } | ||
|
|
||
| ,{ | ||
| "file": "rscg_examples/NLog.Extensions.ThisClass/src/LogDemo/obj/GX/NLog.Extensions.ThisClass/NLog.Extensions.ThisClass.ThisClassNLogGenerator/ClassLoggerLazyAttribute.g.cs", | ||
| "description": "Generated File 2 from 3 : ClassLoggerLazyAttribute.g.cs ", | ||
| "line": 1 | ||
| } | ||
|
|
||
| ,{ | ||
| "file": "rscg_examples/NLog.Extensions.ThisClass/src/LogDemo/obj/GX/NLog.Extensions.ThisClass/NLog.Extensions.ThisClass.ThisClassNLogGenerator/ClassLoggerAttribute.g.cs", | ||
| "description": "Generated File 1 from 3 : ClassLoggerAttribute.g.cs ", | ||
| "line": 1 | ||
| } | ||
|
|
||
| ], | ||
|
|
||
| "ref": "main" | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
|
|
||
| <h1>RSCG nr 261 : NLog.Extensions.ThisClass</h1> | ||
|
|
||
| <h2>Info</h2> | ||
| Nuget : <a href="https://www.nuget.org/packages/NLog.Extensions.ThisClass/" target="_blank">https://www.nuget.org/packages/NLog.Extensions.ThisClass/</a> | ||
|
|
||
| <p>You can find more details at : <a href="https://github.com/trympet/ThisClass" target="_blank"> https://github.com/trympet/ThisClass</a></p> | ||
|
|
||
| <p>Author :Trym Pet</p> | ||
|
|
||
| <p>Source: <a href="https://github.com/trympet/ThisClass" target="_blank">https://github.com/trympet/ThisClass</a> </p> | ||
|
|
||
| <h2>About</h2> | ||
|
|
||
| Generate the NLog register for a class. | ||
|
|
||
| <h2> | ||
| How to use | ||
| </h2> | ||
| <h3> | ||
| Add reference to the <a href="https://www.nuget.org/packages/NLog.Extensions.ThisClass/" target="_blank">NLog.Extensions.ThisClass</a> in the csproj | ||
| </h3> | ||
| <img src="images/NLog.Extensions.ThisClass/LogDemo.csproj.png" width="580" height="580" /> | ||
|
|
||
| <h3>This was for me the <b>starting</b> code</h3> | ||
|
|
||
| <br /> | ||
| I have <b>coded</b> the file Program.cs | ||
| <br /> | ||
| <img src="images/NLog.Extensions.ThisClass/csFiles/Program.cs.png" width="580" height="580" /> | ||
| <hr /> | ||
|
|
||
| <br /> | ||
| I have <b>coded</b> the file Person.cs | ||
| <br /> | ||
| <img src="images/NLog.Extensions.ThisClass/csFiles/Person.cs.png" width="580" height="580" /> | ||
| <hr /> | ||
| <h3>And here are the <i>generated</i> files</h3> | ||
|
|
||
| <br /> | ||
| The file <i>generated</i> is ClassLoggerAttribute.g.cs | ||
| <br /> | ||
| <img src="images/NLog.Extensions.ThisClass/generated/ClassLoggerAttribute.g.cs.png" width="580" height="580" /> | ||
|
|
||
| <br /> | ||
| The file <i>generated</i> is ClassLoggerLazyAttribute.g.cs | ||
| <br /> | ||
| <img src="images/NLog.Extensions.ThisClass/generated/ClassLoggerLazyAttribute.g.cs.png" width="580" height="580" /> | ||
|
|
||
| <br /> | ||
| The file <i>generated</i> is Person_ClassLoggerLazy.g.cs | ||
| <br /> | ||
| <img src="images/NLog.Extensions.ThisClass/generated/Person_ClassLoggerLazy.g.cs.png" width="580" height="580" /> | ||
|
|
||
| <p> | ||
| You can download the code and this page as pdf from | ||
| <a target="_blank" href='https://ignatandrei.github.io/RSCG_Examples/v2/docs/NLog.Extensions.ThisClass'> | ||
| https://ignatandrei.github.io/RSCG_Examples/v2/docs/NLog.Extensions.ThisClass | ||
| </a> | ||
| </p> | ||
|
|
||
|
|
||
| <p> | ||
| You can see the whole list at | ||
| <a target="_blank" href='https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG'> | ||
| https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG | ||
| </a> | ||
| </p> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,7 +17,7 @@ | |||||
| </head> | ||||||
| <body> | ||||||
| <h1> | ||||||
| This is the list of 260 RSCG with examples => | ||||||
| This is the list of 261 RSCG with examples => | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Escape special character to satisfy HTML linting. Line 20 uses a raw 🔧 Proposed fix-This is the list of 261 RSCG with examples =>
+This is the list of 261 RSCG with examples =>📝 Committable suggestion
Suggested change
🧰 Tools🪛 HTMLHint (1.9.2)[error] 20-20: Special characters must be escaped : [ > ]. (spec-char-escape) 🤖 Prompt for AI Agents |
||||||
| </h1> | ||||||
|
|
||||||
| <table > | ||||||
|
|
@@ -1066,6 +1066,10 @@ <h1> | |||||
| <td>260</td> | ||||||
| <td><a href="examples/AssemblyMetadata.html">AssemblyMetadata</a></td> | ||||||
| </tr> | ||||||
| <tr> | ||||||
| <td>261</td> | ||||||
| <td><a href="examples/NLog.Extensions.ThisClass.html">NLog.Extensions.ThisClass</a></td> | ||||||
| </tr> | ||||||
| </table> | ||||||
|
|
||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||
| { | ||||||
| "generator":{ | ||||||
| "name":"NLog.Extensions.ThisClass", | ||||||
| "nuget":[ | ||||||
| "https://www.nuget.org/packages/NLog.Extensions.ThisClass/" | ||||||
| ], | ||||||
| "link":"https://github.com/trympet/ThisClass", | ||||||
| "author":"Trym Pet", | ||||||
| "source":"https://github.com/trympet/ThisClass" | ||||||
| }, | ||||||
| "data":{ | ||||||
| "goodFor":["Generate the NLog register for a class."], | ||||||
|
||||||
| "goodFor":["Generate the NLog register for a class."], | |
| "goodFor":["Generate an NLog logger for a class."], |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Create class loggers using source generators powered by Roslyn. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| # ThisClass | ||
| Exposes class and type information as constants in the ThisClass class using source generators powered by Roslyn, inspired by ThisAssembly. | ||
|
|
||
| ## ThisClass | ||
| Add the `ThisClassAttribute` to generate type information for a class. | ||
| ```csharp | ||
| [ThisClass] | ||
| partial class Demo | ||
| { | ||
| public Demo() | ||
| { | ||
| Logger.Info($"Hello from {ThisClass.FullName}"); // SampleApp.Demo | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
| ## NLog.Extensions.ThisClass | ||
| Create class loggers without using reflection. | ||
| ```csharp | ||
| using SomeNamespace; | ||
|
|
||
| namespace SampleApp.NLog | ||
| { | ||
| ... | ||
| namespace AnotherNamespace | ||
| { | ||
| using SomeOtherNamespace; | ||
| [ClassLoggerLazy] | ||
| partial class Demo2<T> : SomeInterface<T> where T : SomeOtherInterface | ||
| { | ||
| public static void SayHello() | ||
| { | ||
| Logger.Info("Hello"); | ||
| } | ||
|
|
||
| [ClassLogger] | ||
| internal partial class NestedClass : SomeInterface<SomeOtherInterface> | ||
| { | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Looks like this behind the scenes | ||
| ```csharp | ||
| // <auto-generated/> | ||
| #nullable enable | ||
| namespace SampleApp.NLog | ||
| { | ||
| partial class Demo1 | ||
| { | ||
| public static partial class ThisClass | ||
| { | ||
| /// <summary> | ||
| /// Gets the fully qualified name of the parent class, including the namespace but not the assembly. | ||
| /// </summary> | ||
| public const string FullName = "SampleApp.NLog.Demo1"; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // <auto-generated/> | ||
| #nullable enable | ||
| namespace SampleApp.NLog | ||
| { | ||
| namespace AnotherNamespace | ||
| { | ||
| using SomeOtherNamespace; | ||
|
|
||
| partial class Demo2<T> : global::SomeNamespace.SomeInterface<T> where T : global::SomeOtherNamespace.SomeOtherInterface | ||
| { | ||
| public static partial class ThisClass | ||
| { | ||
| /// <summary> | ||
| /// Gets the fully qualified name of the parent class, including the namespace but not the assembly. | ||
| /// </summary> | ||
| public const string FullName = "SampleApp.NLog.AnotherNamespace.Demo2"; | ||
| } | ||
|
|
||
| private static global::NLog.Logger? __loggerLazy; | ||
| private static global::NLog.Logger Logger => __loggerLazy ??= global::NLog.LogManager.GetLogger(ThisClass.FullName); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // <auto-generated/> | ||
| #nullable enable | ||
| namespace SampleApp.NLog | ||
| { | ||
| namespace AnotherNamespace | ||
| { | ||
| using SomeOtherNamespace; | ||
|
|
||
| partial class Demo2<T> : global::SomeNamespace.SomeInterface<T> where T : global::SomeOtherNamespace.SomeOtherInterface | ||
| { | ||
| partial class NestedClass : global::SomeNamespace.SomeInterface<global::SomeOtherNamespace.SomeOtherInterface> | ||
| { | ||
| public static partial class ThisClass | ||
| { | ||
| /// <summary> | ||
| /// Gets the fully qualified name of the parent class, including the namespace but not the assembly. | ||
| /// </summary> | ||
| public const string FullName = "SampleApp.NLog.AnotherNamespace.Demo2.NestedClass"; | ||
| } | ||
|
|
||
| private static readonly global::NLog.Logger Logger = global::NLog.LogManager.GetLogger(ThisClass.FullName); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <Solution> | ||
| <Project Path="LogDemo/LogDemo.csproj" /> | ||
| </Solution> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="NLog" Version="6.1.2" /> | ||
| <PackageReference Include="NLog.Extensions.Logging" Version="6.1.2" /> | ||
| <PackageReference Include="NLog.Extensions.ThisClass" Version="1.6.7" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <None Update="NLog.config"> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| </None> | ||
| </ItemGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> | ||
| <CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath> | ||
| </PropertyGroup> | ||
| </Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an HTML doctype declaration at the top.
The document starts with content but no doctype, which matches the static-analysis error and can cause standards-mode inconsistencies.
🛠️ Proposed fix
+<!doctype html> <h1>RSCG nr 261 : NLog.Extensions.ThisClass</h1>📝 Committable suggestion
🧰 Tools
🪛 HTMLHint (1.9.2)
[error] 2-2: Doctype must be declared before any non-comment content.
(doctype-first)
🤖 Prompt for AI Agents