Skip to content

Commit d4b19a0

Browse files
authored
Add files via upload
1 parent b4d4085 commit d4b19a0

33 files changed

Lines changed: 1349 additions & 0 deletions

Tofu.Samples.sln

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27428.2027
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TofuLogging01", "TofuLogging01\TofuLogging01.csproj", "{B947F6B2-0A57-4D9C-9F77-C2690DCB518B}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TofuLogging02", "TofuLogging02\TofuLogging02.csproj", "{CA5CB1BB-E854-4A61-9FB4-4583E1D50920}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TofuLogging03", "TofuLogging03\TofuLogging03.csproj", "{07D2CABD-D794-423A-8AC6-CFB28061F9EE}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TofuLogging04", "TofuLogging04\TofuLogging04.csproj", "{67EA66F9-32F5-427E-9013-1BE05BEC8C2F}"
13+
EndProject
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TofuLogging05", "TofuLogging05\TofuLogging05.csproj", "{702E34EB-8858-4084-88FB-189227C9FBFB}"
15+
EndProject
16+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TofuLogging06", "TofuLogging06\TofuLogging06.csproj", "{3313C14F-6B84-49C4-BCB5-4B412AE2BEAC}"
17+
EndProject
18+
Global
19+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
20+
Debug|Any CPU = Debug|Any CPU
21+
Release|Any CPU = Release|Any CPU
22+
EndGlobalSection
23+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
24+
{B947F6B2-0A57-4D9C-9F77-C2690DCB518B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25+
{B947F6B2-0A57-4D9C-9F77-C2690DCB518B}.Debug|Any CPU.Build.0 = Debug|Any CPU
26+
{B947F6B2-0A57-4D9C-9F77-C2690DCB518B}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{B947F6B2-0A57-4D9C-9F77-C2690DCB518B}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{CA5CB1BB-E854-4A61-9FB4-4583E1D50920}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{CA5CB1BB-E854-4A61-9FB4-4583E1D50920}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{CA5CB1BB-E854-4A61-9FB4-4583E1D50920}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{CA5CB1BB-E854-4A61-9FB4-4583E1D50920}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{07D2CABD-D794-423A-8AC6-CFB28061F9EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{07D2CABD-D794-423A-8AC6-CFB28061F9EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{07D2CABD-D794-423A-8AC6-CFB28061F9EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{07D2CABD-D794-423A-8AC6-CFB28061F9EE}.Release|Any CPU.Build.0 = Release|Any CPU
36+
{67EA66F9-32F5-427E-9013-1BE05BEC8C2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37+
{67EA66F9-32F5-427E-9013-1BE05BEC8C2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
38+
{67EA66F9-32F5-427E-9013-1BE05BEC8C2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
39+
{67EA66F9-32F5-427E-9013-1BE05BEC8C2F}.Release|Any CPU.Build.0 = Release|Any CPU
40+
{702E34EB-8858-4084-88FB-189227C9FBFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41+
{702E34EB-8858-4084-88FB-189227C9FBFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
42+
{702E34EB-8858-4084-88FB-189227C9FBFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
43+
{702E34EB-8858-4084-88FB-189227C9FBFB}.Release|Any CPU.Build.0 = Release|Any CPU
44+
{3313C14F-6B84-49C4-BCB5-4B412AE2BEAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45+
{3313C14F-6B84-49C4-BCB5-4B412AE2BEAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
46+
{3313C14F-6B84-49C4-BCB5-4B412AE2BEAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
47+
{3313C14F-6B84-49C4-BCB5-4B412AE2BEAC}.Release|Any CPU.Build.0 = Release|Any CPU
48+
EndGlobalSection
49+
GlobalSection(SolutionProperties) = preSolution
50+
HideSolutionNode = FALSE
51+
EndGlobalSection
52+
GlobalSection(ExtensibilityGlobals) = postSolution
53+
SolutionGuid = {6F495360-1A5E-477E-A68D-1DDFF08B5C95}
54+
EndGlobalSection
55+
EndGlobal

TofuLogging01/App.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+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
5+
</startup>
6+
</configuration>

TofuLogging01/Program.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using Tofu.Logging;
3+
4+
namespace TofuLogging01
5+
{
6+
class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
// Start sample
11+
Console.WriteLine("Running TofuLogging01...");
12+
13+
// Create a default manager and start logging session (ie. start dedicated logging thread)
14+
var logMgr = LogManager.CreateManager().StartSession();
15+
16+
// Create logger with preference for Log4Net interface
17+
var log = logMgr.GetLog("MyLog") as ILog4N;
18+
19+
// Dump some messages
20+
log.Debug(() => "Debug entries have lowest level and are typically used to give technical context");
21+
log.Info(() => "Info entries are next on logging level and are used to give functional context");
22+
log.Warn(() => "Warnings are for when things get interesting because some expectations could not be fulfilled");
23+
log.Error(() => "Errors are for serious issues although it's still possible that the application will survive");
24+
log.Fatal(() => "Fatals you do not want to see because basically things are now out of control");
25+
26+
// Stop session (ie. stop the dedicated logging thread)
27+
logMgr.StopSession();
28+
29+
// Show where logfiles are written
30+
Console.WriteLine(string.Format("Log files: {0}", logMgr.SessionFolderFullName));
31+
Console.WriteLine("Press any key to stop...");
32+
Console.ReadKey();
33+
}
34+
}
35+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Reflection;
2+
3+
[assembly: AssemblyTitle("TofuLogging01")]
4+
[assembly: AssemblyDescription("")]
5+
[assembly: AssemblyCompany("Peter Hagenaers")]
6+
[assembly: AssemblyProduct("Tofu Logging")]
7+
[assembly: AssemblyCopyright("Copyright © 2018 - Peter Hagenaers")]
8+
[assembly: AssemblyTrademark("")]
9+
[assembly: AssemblyCulture("")]
10+
[assembly: AssemblyVersion("1.0.2.0")]
11+
[assembly: AssemblyFileVersion("1.0.2.0")]
12+
[assembly: AssemblyInformationalVersion("1.0.2.0")]
13+
14+
#if DEBUG || Debug
15+
[assembly: AssemblyConfiguration("Debug")]
16+
#else
17+
[assembly: AssemblyConfiguration("Release")]
18+
#endif

TofuLogging01/TofuLogging01.csproj

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{B947F6B2-0A57-4D9C-9F77-C2690DCB518B}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>TofuLogging01</RootNamespace>
10+
<AssemblyName>TofuLogging01</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>..\..\..\Binary\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>..\..\..\Binary\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<Reference Include="System" />
38+
<Reference Include="System.Core" />
39+
<Reference Include="System.Xml.Linq" />
40+
<Reference Include="System.Data.DataSetExtensions" />
41+
<Reference Include="Microsoft.CSharp" />
42+
<Reference Include="System.Data" />
43+
<Reference Include="System.Net.Http" />
44+
<Reference Include="System.Xml" />
45+
<Reference Include="Tofu.Logging, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
46+
<SpecificVersion>False</SpecificVersion>
47+
<HintPath>..\..\..\Binary\Tofu.Logging.dll</HintPath>
48+
<Private>False</Private>
49+
</Reference>
50+
</ItemGroup>
51+
<ItemGroup>
52+
<Compile Include="Program.cs" />
53+
<Compile Include="Properties\AssemblyInfo.cs" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<None Include="App.config" />
57+
</ItemGroup>
58+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
59+
</Project>

TofuLogging02/App.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+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
5+
</startup>
6+
</configuration>

TofuLogging02/Program.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
using Tofu.Logging;
3+
4+
namespace TofuLogging02
5+
{
6+
class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
// Start sample
11+
Console.WriteLine("Running TofuLogging02...");
12+
13+
// Create a default manager and start logging session (ie. start dedicated logging thread)
14+
var logMgr = LogManager.CreateManager().StartSession();
15+
16+
// Create logger for messages
17+
var log = logMgr.GetLog("Messages") as ILog4N;
18+
19+
// Create log on the fly for details about the loop
20+
var count = 100000;
21+
logMgr.GetLog("Loop").AddParams(
22+
LogLevel.Debug,
23+
() => "Loop starts",
24+
() => new string[] { "count" },
25+
() => new object[] { count });
26+
27+
// Dump a lot of messages to see how fast Tofu processes them
28+
var start = DateTime.Now;
29+
for (int i = 0; i < count; i++)
30+
log.Info(i.ToString());
31+
var end = DateTime.Now;
32+
33+
// Indicate loop terminated
34+
logMgr.GetLog("Loop").AddText(LogLevel.Debug, () => "Loop ends");
35+
36+
// Stop session (ie. stop the dedicated logging thread)
37+
logMgr.StopSession();
38+
39+
// Show where logfiles are written
40+
Console.WriteLine(string.Format("Writing #{0} entries took {1}ms.", count, (end - start).TotalMilliseconds));
41+
Console.WriteLine(string.Format("Log files: {0}", logMgr.SessionFolderFullName));
42+
Console.WriteLine("Press any key to stop...");
43+
Console.ReadKey();
44+
}
45+
}
46+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Reflection;
2+
3+
[assembly: AssemblyTitle("TofuLogging02")]
4+
[assembly: AssemblyDescription("")]
5+
[assembly: AssemblyCompany("Peter Hagenaers")]
6+
[assembly: AssemblyProduct("Tofu Logging")]
7+
[assembly: AssemblyCopyright("Copyright © 2018 - Peter Hagenaers")]
8+
[assembly: AssemblyTrademark("")]
9+
[assembly: AssemblyCulture("")]
10+
[assembly: AssemblyVersion("1.0.2.0")]
11+
[assembly: AssemblyFileVersion("1.0.2.0")]
12+
[assembly: AssemblyInformationalVersion("1.0.2.0")]
13+
14+
#if DEBUG || Debug
15+
[assembly: AssemblyConfiguration("Debug")]
16+
#else
17+
[assembly: AssemblyConfiguration("Release")]
18+
#endif

TofuLogging02/TofuLogging02.csproj

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{CA5CB1BB-E854-4A61-9FB4-4583E1D50920}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>TofuLogging02</RootNamespace>
10+
<AssemblyName>TofuLogging02</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>..\..\..\Binary\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>..\..\..\Binary\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<Reference Include="System" />
38+
<Reference Include="System.Core" />
39+
<Reference Include="System.Xml.Linq" />
40+
<Reference Include="System.Data.DataSetExtensions" />
41+
<Reference Include="Microsoft.CSharp" />
42+
<Reference Include="System.Data" />
43+
<Reference Include="System.Net.Http" />
44+
<Reference Include="System.Xml" />
45+
<Reference Include="Tofu.Logging">
46+
<HintPath>..\..\..\Binary\Tofu.Logging.dll</HintPath>
47+
<Private>False</Private>
48+
</Reference>
49+
</ItemGroup>
50+
<ItemGroup>
51+
<Compile Include="Program.cs" />
52+
<Compile Include="Properties\AssemblyInfo.cs" />
53+
</ItemGroup>
54+
<ItemGroup>
55+
<None Include="App.config" />
56+
</ItemGroup>
57+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
58+
</Project>

TofuLogging03/App.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+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
5+
</startup>
6+
</configuration>

0 commit comments

Comments
 (0)