-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #612 from Sitecore/feature/610-Analyze_log_files_a…
…nd_Open_log_file_commands_in_context_menu_do_not_work_for_Sitecore_members Feature/610 analyze log files and open log file commands in context menu do not work for sitecore members
- Loading branch information
Showing
8 changed files
with
117 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/SIM.Tool.Windows/LogFileFolder/LogFileFolderFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using SIM.Instances; | ||
|
||
namespace SIM.Tool.Windows.LogFileFolder | ||
{ | ||
public static class LogFileFolderFactory | ||
{ | ||
public static LogFileFolderResolver GetResolver(Instance instance) | ||
{ | ||
if (instance.Type == Instance.InstanceType.SitecoreMember) | ||
{ | ||
return new SitecoreMembersLogFileFolderResolver(instance); | ||
} | ||
|
||
return new SitecoreDefaultLogFileFolderResolver(instance); | ||
} | ||
|
||
public static LogFileFolderResolver GetDefaultResolver(Instance instance) | ||
{ | ||
return new SitecoreDefaultLogFileFolderResolver(instance); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace SIM.Tool.Windows.LogFileFolder | ||
{ | ||
public abstract class LogFileFolderResolver | ||
{ | ||
public abstract string GetLogFolder(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/SIM.Tool.Windows/LogFileFolder/SitecoreDefaultLogFileFolderResolver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.IO; | ||
using SIM.Extensions; | ||
using SIM.Instances; | ||
|
||
namespace SIM.Tool.Windows.LogFileFolder | ||
{ | ||
public class SitecoreDefaultLogFileFolderResolver : LogFileFolderResolver | ||
{ | ||
private readonly Instance _instance; | ||
|
||
public SitecoreDefaultLogFileFolderResolver(Instance instance) | ||
{ | ||
this._instance = instance; | ||
} | ||
|
||
public override string GetLogFolder() | ||
{ | ||
var dataFolderPath = _instance.DataFolderPath; | ||
|
||
FileSystem.FileSystem.Local.Directory.AssertExists(dataFolderPath, "The data folder ({0}) of the {1} instance doesn't exist".FormatWith(dataFolderPath, _instance.Name)); | ||
|
||
return Path.Combine(dataFolderPath, "logs"); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/SIM.Tool.Windows/LogFileFolder/SitecoreMembersLogFileFolderResolver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using SIM.Instances; | ||
|
||
namespace SIM.Tool.Windows.LogFileFolder | ||
{ | ||
public class SitecoreMembersLogFileFolderResolver : LogFileFolderResolver | ||
{ | ||
private readonly Instance _instance; | ||
|
||
public SitecoreMembersLogFileFolderResolver(Instance instance) | ||
{ | ||
this._instance = instance; | ||
} | ||
|
||
public override string GetLogFolder() | ||
{ | ||
// Sitecore members like Identity Server contain the logs folder inside the root folder | ||
string logsPath = FileSystem.FileSystem.Local.Directory.MapPath("logs", _instance.WebRootPath); | ||
if (FileSystem.FileSystem.Local.Directory.Exists(logsPath)) | ||
{ | ||
return logsPath; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters