Skip to content

Commit be571fb

Browse files
committed
Convert all files to LF line endings
1 parent 742014d commit be571fb

File tree

2 files changed

+5668
-5668
lines changed

2 files changed

+5668
-5668
lines changed

Runtime/Game/LootLockerLogger.cs

Lines changed: 123 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,124 @@
1-
using System;
2-
using System.Collections;
3-
using System.Collections.Generic;
4-
using UnityEngine;
5-
6-
namespace LootLocker
7-
{
8-
public class LootLockerLogger
9-
{
10-
public enum LogLevel
11-
{
12-
Verbose
13-
, Info
14-
, Warning
15-
, Error
16-
}
17-
18-
/// <summary>
19-
/// Get logger for the specified level. Use like: GetForLevel(LogLevel::Info)(message);
20-
/// </summary>
21-
/// <param name="logLevel">What level should this be logged as</param>
22-
public static Action<string> GetForLogLevel(LogLevel logLevel = LogLevel.Info)
23-
{
24-
if (!ShouldLog(logLevel))
25-
{
26-
return ignored => { };
27-
}
28-
29-
AdjustLogLevelToSettings(ref logLevel);
30-
31-
switch (logLevel)
32-
{
33-
case LogLevel.Error:
34-
return Debug.LogError;
35-
case LogLevel.Warning:
36-
return Debug.LogWarning;
37-
case LogLevel.Verbose:
38-
case LogLevel.Info:
39-
default:
40-
return Debug.Log;
41-
}
42-
}
43-
44-
private static bool ShouldLog(LogLevel logLevel)
45-
{
46-
#if UNITY_EDITOR
47-
switch (logLevel)
48-
{
49-
case LogLevel.Error:
50-
{
51-
if (LootLockerConfig.current == null ||
52-
(new List<LootLockerConfig.DebugLevel>
53-
{
54-
LootLockerConfig.DebugLevel.All,
55-
LootLockerConfig.DebugLevel.AllAsNormal,
56-
LootLockerConfig.DebugLevel.ErrorOnly
57-
}).Contains(LootLockerConfig.current.currentDebugLevel))
58-
{
59-
return true;
60-
}
61-
62-
break;
63-
}
64-
case LogLevel.Warning:
65-
{
66-
if (LootLockerConfig.current == null ||
67-
(new List<LootLockerConfig.DebugLevel>
68-
{
69-
LootLockerConfig.DebugLevel.All,
70-
LootLockerConfig.DebugLevel.AllAsNormal
71-
})
72-
.Contains(LootLockerConfig.current.currentDebugLevel))
73-
{
74-
return true;
75-
}
76-
77-
break;
78-
}
79-
case LogLevel.Verbose:
80-
{
81-
if (LootLockerConfig.current == null ||
82-
(new List<LootLockerConfig.DebugLevel>
83-
{
84-
LootLockerConfig.DebugLevel.All,
85-
LootLockerConfig.DebugLevel.AllAsNormal
86-
})
87-
.Contains(LootLockerConfig.current.currentDebugLevel))
88-
{
89-
return true;
90-
}
91-
92-
break;
93-
}
94-
case LogLevel.Info:
95-
default:
96-
{
97-
if (LootLockerConfig.current == null ||
98-
(new List<LootLockerConfig.DebugLevel>
99-
{
100-
LootLockerConfig.DebugLevel.All,
101-
LootLockerConfig.DebugLevel.AllAsNormal,
102-
LootLockerConfig.DebugLevel.NormalOnly
103-
}).Contains(LootLockerConfig.current.currentDebugLevel))
104-
{
105-
return true;
106-
}
107-
108-
break;
109-
}
110-
}
111-
#endif
112-
113-
return false;
114-
}
115-
116-
private static void AdjustLogLevelToSettings(ref LogLevel logLevel)
117-
{
118-
if (LootLockerConfig.current != null && LootLockerConfig.DebugLevel.AllAsNormal == LootLockerConfig.current.currentDebugLevel)
119-
{
120-
logLevel = LogLevel.Info;
121-
}
122-
}
123-
}
1+
using System;
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
using UnityEngine;
5+
6+
namespace LootLocker
7+
{
8+
public class LootLockerLogger
9+
{
10+
public enum LogLevel
11+
{
12+
Verbose
13+
, Info
14+
, Warning
15+
, Error
16+
}
17+
18+
/// <summary>
19+
/// Get logger for the specified level. Use like: GetForLevel(LogLevel::Info)(message);
20+
/// </summary>
21+
/// <param name="logLevel">What level should this be logged as</param>
22+
public static Action<string> GetForLogLevel(LogLevel logLevel = LogLevel.Info)
23+
{
24+
if (!ShouldLog(logLevel))
25+
{
26+
return ignored => { };
27+
}
28+
29+
AdjustLogLevelToSettings(ref logLevel);
30+
31+
switch (logLevel)
32+
{
33+
case LogLevel.Error:
34+
return Debug.LogError;
35+
case LogLevel.Warning:
36+
return Debug.LogWarning;
37+
case LogLevel.Verbose:
38+
case LogLevel.Info:
39+
default:
40+
return Debug.Log;
41+
}
42+
}
43+
44+
private static bool ShouldLog(LogLevel logLevel)
45+
{
46+
#if UNITY_EDITOR
47+
switch (logLevel)
48+
{
49+
case LogLevel.Error:
50+
{
51+
if (LootLockerConfig.current == null ||
52+
(new List<LootLockerConfig.DebugLevel>
53+
{
54+
LootLockerConfig.DebugLevel.All,
55+
LootLockerConfig.DebugLevel.AllAsNormal,
56+
LootLockerConfig.DebugLevel.ErrorOnly
57+
}).Contains(LootLockerConfig.current.currentDebugLevel))
58+
{
59+
return true;
60+
}
61+
62+
break;
63+
}
64+
case LogLevel.Warning:
65+
{
66+
if (LootLockerConfig.current == null ||
67+
(new List<LootLockerConfig.DebugLevel>
68+
{
69+
LootLockerConfig.DebugLevel.All,
70+
LootLockerConfig.DebugLevel.AllAsNormal
71+
})
72+
.Contains(LootLockerConfig.current.currentDebugLevel))
73+
{
74+
return true;
75+
}
76+
77+
break;
78+
}
79+
case LogLevel.Verbose:
80+
{
81+
if (LootLockerConfig.current == null ||
82+
(new List<LootLockerConfig.DebugLevel>
83+
{
84+
LootLockerConfig.DebugLevel.All,
85+
LootLockerConfig.DebugLevel.AllAsNormal
86+
})
87+
.Contains(LootLockerConfig.current.currentDebugLevel))
88+
{
89+
return true;
90+
}
91+
92+
break;
93+
}
94+
case LogLevel.Info:
95+
default:
96+
{
97+
if (LootLockerConfig.current == null ||
98+
(new List<LootLockerConfig.DebugLevel>
99+
{
100+
LootLockerConfig.DebugLevel.All,
101+
LootLockerConfig.DebugLevel.AllAsNormal,
102+
LootLockerConfig.DebugLevel.NormalOnly
103+
}).Contains(LootLockerConfig.current.currentDebugLevel))
104+
{
105+
return true;
106+
}
107+
108+
break;
109+
}
110+
}
111+
#endif
112+
113+
return false;
114+
}
115+
116+
private static void AdjustLogLevelToSettings(ref LogLevel logLevel)
117+
{
118+
if (LootLockerConfig.current != null && LootLockerConfig.DebugLevel.AllAsNormal == LootLockerConfig.current.currentDebugLevel)
119+
{
120+
logLevel = LogLevel.Info;
121+
}
122+
}
123+
}
124124
}

0 commit comments

Comments
 (0)