Skip to content

Commit a9e92fd

Browse files
author
Dogukan Erenel
committed
* Added cache / log directory customization
1 parent 1a06a97 commit a9e92fd

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

Scripts/Logging/Logger.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ public static void InstallDefaultReactors( int logHistory = 2 )
132132
#if UNITY_EDITOR || UNITY_IOS || UNITY_ANDROID
133133
LogSystem.Instance.InstallReactor( new DebugReactor() );
134134
#endif
135-
LogSystem.Instance.InstallReactor( new FileReactor( Application.persistentDataPath + "/" + Application.productName + ".log", LogLevel.STATUS, logHistory ) );
135+
136+
if (!string.IsNullOrEmpty(Constants.Path.LOG_FOLDER) && !System.IO.Directory.Exists(Application.persistentDataPath + Constants.Path.LOG_FOLDER ))
137+
System.IO.Directory.CreateDirectory(Application.persistentDataPath + Constants.Path.LOG_FOLDER );
138+
139+
LogSystem.Instance.InstallReactor( new FileReactor( Application.persistentDataPath + Constants.Path.LOG_FOLDER + "/" + Application.productName + ".log", LogLevel.STATUS, logHistory ) );
136140

137141
Application.logMessageReceived += UnityLogCallback;
138142
}

Scripts/Services/Dialog/Dialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ private void OnDialog( ConverseResponse resp )
510510

511511
private void OnFailure(string msg)
512512
{
513-
Log.Error("NaturalLanguageClassifier", msg);
513+
Log.Error("Dialog", msg);
514514
m_Callback(SERVICE_ID, false);
515515
m_DialogCount = 0;
516516
}

Scripts/Utilities/Constants.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,16 @@ public static class Path
619619
/// Configuration file name.
620620
/// </summary>
621621
public const string CONFIG_FILE = "/Config.json";
622+
623+
/// <summary>
624+
/// Cache folder to customize a parent folder for cache directory
625+
/// </summary>
626+
public static string CACHE_FOLDER = ""; //It needs to start with /
627+
628+
/// <summary>
629+
/// Log folder to customize a parent folder for logs
630+
/// </summary>
631+
public static string LOG_FOLDER = ""; //It needs to start with /
622632
}
623633

624634
/// <summary>

Scripts/Utilities/DataCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void Initialize(string cacheName, long maxCacheSize, double maxCacheAge )
7272
m_MaxCacheSize = maxCacheSize;
7373
m_MaxCacheAge = maxCacheAge;
7474

75-
m_CachePath = Application.persistentDataPath + "/" + cacheName + "/";
75+
m_CachePath = Application.persistentDataPath + Constants.Path.CACHE_FOLDER + "/" + cacheName + "/";
7676
if (!Directory.Exists(m_CachePath))
7777
Directory.CreateDirectory(m_CachePath);
7878

0 commit comments

Comments
 (0)