Skip to content

Commit

Permalink
+ Added a configuration for logged release
Browse files Browse the repository at this point in the history
  • Loading branch information
wmjordan committed Feb 14, 2023
1 parent 87a6349 commit 351cf43
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 39 deletions.
37 changes: 10 additions & 27 deletions Codist.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.2092
# Visual Studio Version 17
VisualStudioVersion = 17.5.33402.96
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Codist", "Codist\Codist.csproj", "{357D8F0C-57B1-4981-949D-204FEE0EC424}"
EndProject
Expand All @@ -14,50 +14,33 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{CA2E0B7E-1
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProject", "TestProject\TestProject.csproj", "{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProject2", "TestProject2\TestProject2.csproj", "{F83EC41E-0478-411F-96B9-F2B86D76A69F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject2", "TestProject2\TestProject2.csproj", "{F83EC41E-0478-411F-96B9-F2B86D76A69F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|arm64 = Debug|arm64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|arm64 = Release|arm64
Release|x86 = Release|x86
ReleaseLogged|Any CPU = ReleaseLogged|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{357D8F0C-57B1-4981-949D-204FEE0EC424}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{357D8F0C-57B1-4981-949D-204FEE0EC424}.Debug|Any CPU.Build.0 = Debug|Any CPU
{357D8F0C-57B1-4981-949D-204FEE0EC424}.Debug|arm64.ActiveCfg = Debug|arm64
{357D8F0C-57B1-4981-949D-204FEE0EC424}.Debug|arm64.Build.0 = Debug|arm64
{357D8F0C-57B1-4981-949D-204FEE0EC424}.Debug|x86.ActiveCfg = Debug|x86
{357D8F0C-57B1-4981-949D-204FEE0EC424}.Debug|x86.Build.0 = Debug|x86
{357D8F0C-57B1-4981-949D-204FEE0EC424}.Release|Any CPU.ActiveCfg = Release|Any CPU
{357D8F0C-57B1-4981-949D-204FEE0EC424}.Release|Any CPU.Build.0 = Release|Any CPU
{357D8F0C-57B1-4981-949D-204FEE0EC424}.Release|arm64.ActiveCfg = Release|arm64
{357D8F0C-57B1-4981-949D-204FEE0EC424}.Release|arm64.Build.0 = Release|arm64
{357D8F0C-57B1-4981-949D-204FEE0EC424}.Release|x86.ActiveCfg = Release|x86
{357D8F0C-57B1-4981-949D-204FEE0EC424}.Release|x86.Build.0 = Release|x86
{357D8F0C-57B1-4981-949D-204FEE0EC424}.ReleaseLogged|Any CPU.ActiveCfg = ReleaseLogged|arm64
{357D8F0C-57B1-4981-949D-204FEE0EC424}.ReleaseLogged|Any CPU.Build.0 = ReleaseLogged|arm64
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.Debug|arm64.ActiveCfg = Debug|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.Debug|arm64.Build.0 = Debug|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.Debug|x86.ActiveCfg = Debug|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.Debug|x86.Build.0 = Debug|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.Release|Any CPU.Build.0 = Release|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.Release|arm64.ActiveCfg = Release|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.Release|arm64.Build.0 = Release|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.Release|x86.ActiveCfg = Release|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.Release|x86.Build.0 = Release|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.ReleaseLogged|Any CPU.ActiveCfg = Release|Any CPU
{A271AA17-5C0A-44DF-BBC7-BC54CDB5FCC3}.ReleaseLogged|Any CPU.Build.0 = Release|Any CPU
{F83EC41E-0478-411F-96B9-F2B86D76A69F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F83EC41E-0478-411F-96B9-F2B86D76A69F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F83EC41E-0478-411F-96B9-F2B86D76A69F}.Debug|arm64.ActiveCfg = Debug|Any CPU
{F83EC41E-0478-411F-96B9-F2B86D76A69F}.Debug|x86.ActiveCfg = Debug|Any CPU
{F83EC41E-0478-411F-96B9-F2B86D76A69F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F83EC41E-0478-411F-96B9-F2B86D76A69F}.Release|Any CPU.Build.0 = Release|Any CPU
{F83EC41E-0478-411F-96B9-F2B86D76A69F}.Release|arm64.ActiveCfg = Release|Any CPU
{F83EC41E-0478-411F-96B9-F2B86D76A69F}.Release|x86.ActiveCfg = Release|Any CPU
{F83EC41E-0478-411F-96B9-F2B86D76A69F}.ReleaseLogged|Any CPU.ActiveCfg = Release|Any CPU
{F83EC41E-0478-411F-96B9-F2B86D76A69F}.ReleaseLogged|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
22 changes: 10 additions & 12 deletions Codist/Codist.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@
<UseCodebase>true</UseCodebase>
<TargetFrameworkProfile />
<ApplicationVersion>2.5.0.0</ApplicationVersion>
<ShouldCreateLogs>False</ShouldCreateLogs>
<AdvancedSettingsExpanded>False</AdvancedSettingsExpanded>
<UpdateAssemblyVersion>False</UpdateAssemblyVersion>
<UpdateAssemblyFileVersion>False</UpdateAssemblyFileVersion>
<UpdateAssemblyInfoVersion>False</UpdateAssemblyInfoVersion>
<UpdatePackageVersion>False</UpdatePackageVersion>
<AssemblyInfoVersionType>SettingsVersion</AssemblyInfoVersionType>
<InheritWinAppVersionFrom>None</InheritWinAppVersionFrom>
<AssemblyInfoVersionSettings>
</AssemblyInfoVersionSettings>
<AssemblyFileVersionSettings>
</AssemblyFileVersionSettings>
<UICulture>en-US</UICulture>
</PropertyGroup>
<PropertyGroup>
Expand Down Expand Up @@ -67,6 +55,16 @@
<LangVersion>7.3</LangVersion>
<DeployExtension>False</DeployExtension>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseLogged|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;LOG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>7.3</LangVersion>
<DeployExtension>False</DeployExtension>
</PropertyGroup>
<ItemGroup>
<Compile Include="AutoBuildVersion\BuildConfigSetting.cs" />
<Compile Include="AutoBuildVersion\BuildSetting.cs" />
Expand Down
7 changes: 7 additions & 0 deletions Codist/Helpers/LogHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

namespace Codist
{
/// <summary>
/// <para>A simple logger which logs information to the file in <see cref="LogPath"/>. The file must pre-exist before <see cref="LogPath"/> is specified.</para>
/// <para>By default, all log methods are simply ignored. Specify "<c>LOG</c>" in <i>conditional compilation symbols</i> of the project.</para>
/// </summary>
static class LogHelper
{
static int _Sync;
Expand All @@ -17,6 +21,7 @@ public static string LogPath {
set => _Path = File.Exists(value) ? value : null;
}

[Conditional("LOG")]
public static void Log(this string message) {
if (_Path != null) {
WriteLog(message);
Expand All @@ -39,10 +44,12 @@ static void WriteLog(string message) {
}
}

[Conditional("LOG")]
public static void Log(this Exception exception) {
Log(exception.ToString());
}

[Conditional("LOG")]
public static void ClearLog() {
if (File.Exists(LogPath)) {
try {
Expand Down

0 comments on commit 351cf43

Please sign in to comment.