From bbf09132e783c5b5922dee055db3fc1972508539 Mon Sep 17 00:00:00 2001 From: Guillaume CHAUVEL Date: Mon, 12 Jun 2023 15:31:38 +0200 Subject: [PATCH] Fix yaml `logPath` case --- doc/yamlConfigFile.md | 4 ++-- examples/sample-allOption.yml | 2 +- src/WinSW.Tests/ServiceDescriptorYamlTest.cs | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/doc/yamlConfigFile.md b/doc/yamlConfigFile.md index 01b3bd9..5bd5558 100644 --- a/doc/yamlConfigFile.md +++ b/doc/yamlConfigFile.md @@ -96,14 +96,14 @@ depend: ### log -Optionally set a different logging directory with `logpath` and startup `mode`: append (default), reset (clear log), ignore, roll (move to `\*.old`). +Optionally set a different logging directory with `logPath` and startup `mode`: append (default), reset (clear log), ignore, roll (move to `\*.old`). User can specify all log configurations as a single YAML dictionary ```yaml log: mode: roll-by-size - logpath: '%BASE%\log' + logPath: '%BASE%\log' sizeThreshold: 10240 keepFiles: 8 ``` diff --git a/examples/sample-allOption.yml b/examples/sample-allOption.yml index 177f0b1..b152ddf 100644 --- a/examples/sample-allOption.yml +++ b/examples/sample-allOption.yml @@ -38,7 +38,7 @@ waitHint: 15 sec sleepTime: 1 sec #interactive: true log: -# logpath: '%BASE%\logs' +# logPath: '%BASE%\logs' mode: append #env: # - diff --git a/src/WinSW.Tests/ServiceDescriptorYamlTest.cs b/src/WinSW.Tests/ServiceDescriptorYamlTest.cs index f78fdb6..2cb21cd 100644 --- a/src/WinSW.Tests/ServiceDescriptorYamlTest.cs +++ b/src/WinSW.Tests/ServiceDescriptorYamlTest.cs @@ -12,6 +12,7 @@ namespace winswTests private IServiceConfig _extendedServiceDescriptor; private const string ExpectedWorkingDirectory = @"Z:\Path\SubPath"; + private const string ExpectedLogDirectory = @"c:\logs"; private const string Username = "User"; private const string Password = "Password"; private const string Domain = "Domain"; @@ -29,7 +30,7 @@ executable: node.exe arguments: My Arguments log: mode: roll - logpath: c:\logs + logPath: {ExpectedLogDirectory} serviceAccount: domain: {Domain} user: {Username} @@ -82,6 +83,13 @@ startMode: manual"; Assert.That(this._extendedServiceDescriptor.WorkingDirectory, Is.EqualTo(ExpectedWorkingDirectory)); } + [Test] + public void VerifyLogPath() + { + Assert.That(this._extendedServiceDescriptor.Log.Directory, Is.EqualTo(ExpectedLogDirectory)); + Assert.That(this._extendedServiceDescriptor.LogDirectory, Is.EqualTo(ExpectedLogDirectory)); + } + [Test] public void VerifyServiceLogonRight() { @@ -265,7 +273,7 @@ name: Service description: The Service. executable: node.exe log: - logpath: 'c:\\' + logPath: 'c:\\' mode: roll-by-size sizeThreshold: 112 keepFiles: 113"; @@ -289,7 +297,7 @@ name: Service description: The Service. executable: node.exe log: - logpath: c:\\ + logPath: c:\\ mode: roll-by-time period: 7 pattern: log pattern"; @@ -313,7 +321,7 @@ name: Service description: The Service. executable: node.exe log: - logpath: c:\\ + logPath: c:\\ mode: roll-by-size-time sizeThreshold: 10240 pattern: yyyy-MM-dd