diff --git a/MinVer.Lib/NullLogger.cs b/MinVer.Lib/NullLogger.cs new file mode 100644 index 00000000..37cd2365 --- /dev/null +++ b/MinVer.Lib/NullLogger.cs @@ -0,0 +1,17 @@ +namespace MinVer.Lib +{ + internal class NullLogger : ILogger + { + public bool IsTraceEnabled => false; + + public bool IsDebugEnabled => false; + + public void Debug(string message) { } + + public void Info(string message) { } + + public void Trace(string message) { } + + public void Warn(int code, string message) { } + } +} diff --git a/MinVer.Lib/Versioner.cs b/MinVer.Lib/Versioner.cs index a4982fb7..9ddbf6a4 100644 --- a/MinVer.Lib/Versioner.cs +++ b/MinVer.Lib/Versioner.cs @@ -4,10 +4,7 @@ public static class Versioner { public static Version GetVersion(string repoOrWorkDir, string tagPrefix, MajorMinor minMajorMinor, string buildMeta, VersionPart autoIncrement, string defaultPreReleasePhase, ILogger log) { - if (log == null) - { - throw new System.ArgumentNullException(nameof(log)); - } + log = log ?? new NullLogger(); defaultPreReleasePhase = string.IsNullOrEmpty(defaultPreReleasePhase) ? "alpha"