Skip to content

Commit 2ea576e

Browse files
author
András Kurai
committed
add more logging
1 parent 96d06ed commit 2ea576e

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

UnityResourceGenerator/Assets/UnityResourceGenerator/Editor/Generation/RemoveUnnecessaryNewLines.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@ namespace UnityResourceGenerator.Editor.Generation
44
{
55
public sealed class RemoveUnnecessaryNewLines : IResourcePostProcessor
66
{
7-
public string PostProcess(ResourceContext context, string resourceFileContent) =>
8-
Regex.Replace(resourceFileContent, @"^\s+$[\r\n]*", string.Empty, RegexOptions.Multiline);
7+
public string PostProcess(ResourceContext context, string resourceFileContent)
8+
{
9+
context.Info("Started removing unnecessary new lines");
10+
11+
var output = Regex.Replace(resourceFileContent, @"^\s+$[\r\n]*", string.Empty, RegexOptions.Multiline);
12+
13+
context.Info("Finished removing unnecessary new lines");
14+
15+
return output;
16+
}
917

1018
public int PostProcessPriority { get; } = 0;
1119
}

UnityResourceGenerator/Assets/UnityResourceGenerator/Editor/Generation/ScenesModule.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public sealed class ScenesModule : IModuleGenerator
99
{
1010
public string Generate(ResourceContext context)
1111
{
12+
context.Info("Started generating scenes");
13+
1214
// ReSharper disable once MissingIndent
1315
const string classBegin =
1416
@"
@@ -35,7 +37,7 @@ public static partial class Scenes
3537
throw new InvalidOperationException("Found duplicate file names");
3638
}
3739

38-
return values
40+
var output = values
3941
.Aggregate(
4042
new StringBuilder().Append(classBegin),
4143
(sb, s) => sb
@@ -46,6 +48,10 @@ public static partial class Scenes
4648
.AppendLine("\";"))
4749
.AppendLine(classEnd)
4850
.ToString();
51+
52+
context.Info("Finished generating scenes");
53+
54+
return output;
4955
}
5056
}
5157
}

UnityResourceGenerator/Assets/UnityResourceGenerator/Editor/ResourceFileMenu.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static void GenerateResources()
2525
settings.LogError ? Debug.LogError : LogEmpty
2626
);
2727

28+
context.Info("Resource Path generation started");
2829
var fileContent = ResourceFileGenerator.CreateResourceFile(context);
2930

3031
var filePath = Path.GetFullPath(Path.Combine(context.AssetsFolder, context.FolderPath, $"{context.ClassName}.cs"));

0 commit comments

Comments
 (0)