Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.

Commit

Permalink
update logging levels where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
Crzyrndm committed May 7, 2016
1 parent a82a5ac commit 82e9231
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
10 changes: 5 additions & 5 deletions FilterExtension/ConfigNodes/customCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ public void initialise()
{
if (string.IsNullOrEmpty(categoryName))
{
Core.Log("Category name is null or empty");
Core.Log("Category name is null or empty", Core.LogLevel.Warn);
return;
}
if (!hasSubCategories())
{
Core.Log(categoryName + " has no subcategories");
Core.Log(categoryName + " has no subcategories", Core.LogLevel.Warn);
return;
}
PartCategorizer.Category category;
Expand All @@ -173,7 +173,7 @@ public void initialise()
{
if (!PartCategorizer.Instance.filters.TryGetValue(c => c.button.categoryName == categoryName, out category))
{
Core.Log("No category of this name was found to manipulate: " + categoryName);
Core.Log("No category of this name was found to manipulate: " + categoryName, Core.LogLevel.Warn);
return;
}
else if (behaviour == categoryBehaviour.Replace)
Expand All @@ -197,15 +197,15 @@ public void initSubcategory(int index, subCategoryItem toInit, PartCategorizer.C
if (conflictsList.Contains(subCategories[j].subcategoryName))
{
// if so, we skip this subcategory
Core.Log("Filters duplicated in category {0} between subCategories:\r\n{1} and {2}", Core.LogLevel.Log, categoryName, toInit.ToString(), subCategories[j].subcategoryName);
Core.Log("Filters duplicated in category {0} between subCategories:\r\n{1} and {2}", Core.LogLevel.Warn, categoryName, toInit.ToString(), subCategories[j].subcategoryName);
return;
}
}
}
customSubCategory subcategory = null;
if (!Core.Instance.subCategoriesDict.TryGetValue(toInit.ToString(), out subcategory))
{
Core.Log("subcategory {0} not found in subcategories Dictionary", Core.LogLevel.Log, toInit.ToString());
Core.Log("subcategory {0} not found in subcategories Dictionary", Core.LogLevel.Warn, toInit.ToString());
return;
}

Expand Down
4 changes: 2 additions & 2 deletions FilterExtension/ConfigNodes/customSubCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ public bool checkSubCategoryHasParts(string category)
if (Settings.debug)
{
if (!string.IsNullOrEmpty(category))
Core.Log(subCategoryTitle + " in category " + category + " has no valid parts and was not initialised");
Core.Log(subCategoryTitle + " in category " + category + " has no valid parts and was not initialised", Core.LogLevel.Warn);
else
Core.Log(subCategoryTitle + " has no valid parts and was not initialised");
Core.Log(subCategoryTitle + " has no valid parts and was not initialised", Core.LogLevel.Warn);
}
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions FilterExtension/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void Awake()
{
instance = this;
DontDestroyOnLoad(this);
Log(string.Empty);
Log(string.Empty, LogLevel.Warn);

getConfigs();
getPartData();
Expand Down Expand Up @@ -141,7 +141,7 @@ private void getPartData()
if (!partPathDict.ContainsKey(p.name))
partPathDict.Add(p.name, p.partUrl);
else
Log(p.name + " duplicated part key in part path dictionary");
Log(p.name + " duplicated part key in part path dictionary", LogLevel.Warn);

if (PartType.isEngine(p))
processEnginePropellants(p);
Expand Down
14 changes: 6 additions & 8 deletions FilterExtension/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private IEnumerator editorInit()
yield return null;

if (Settings.debug)
Core.Log("Starting on Stock Filters");
Core.Log("Starting on Stock Filters", Core.LogLevel.Log);

// stock filters
// If I edit them later everything breaks
Expand All @@ -58,7 +58,7 @@ private IEnumerator editorInit()
for (int i = 0; i < 4; i++)
yield return null;
if (Settings.debug)
Core.Log("Starting on general categories");
Core.Log("Starting on general categories", Core.LogLevel.Log);

// all FE categories
foreach (customCategory c in Core.Instance.Categories)
Expand All @@ -71,7 +71,7 @@ private IEnumerator editorInit()
for (int i = 0; i < 4; i++)
yield return null;
if (Settings.debug)
Core.Log("Starting on late categories");
Core.Log("Starting on late categories", Core.LogLevel.Log);

// generate the set of parts to block
if (blackListedParts == null)
Expand All @@ -95,7 +95,7 @@ private IEnumerator editorInit()
for (int i = 0; i < 4; i++)
yield return null;
if (Settings.debug)
Core.Log("Starting on removing categories");
Core.Log("Starting on removing categories", Core.LogLevel.Log);
List<PartCategorizer.Category> catsToDelete = PartCategorizer.Instance.filters.FindAll(c => c.subcategories.Count == 0);
foreach (PartCategorizer.Category cat in catsToDelete)
{
Expand All @@ -110,7 +110,7 @@ private IEnumerator editorInit()
for (int i = 0; i < 4; i++)
yield return null;
if (Settings.debug)
Core.Log("Refreshing parts list");
Core.Log("Refreshing parts list", Core.LogLevel.Log);
setSelectedCategory();

subcategoriesChecked = ready = true;
Expand Down Expand Up @@ -169,9 +169,7 @@ public static void setSelectedCategory()
}
catch (Exception e)
{
Core.Log("Category refresh failed");
Core.Log(e.InnerException);
Core.Log(e.StackTrace);
Core.Log("Category refresh failed\r\n{0}\r\n{1}", Core.LogLevel.Error, e.InnerException, e.StackTrace);
}
}

Expand Down
Binary file modified GameData/000_FilterExtensions/FilterExtensions.dll
Binary file not shown.

0 comments on commit 82e9231

Please sign in to comment.