Skip to content

Commit 325b575

Browse files
committed
Update compiler related logging
1 parent 8f82b09 commit 325b575

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

src/CompilerService.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -165,25 +165,25 @@ private bool Start()
165165
{
166166
process?.Dispose();
167167
process = null;
168-
Log(LogType.Error, $"Exception while starting compiler", exception: ex);
168+
Interface.Oxide.LogException($"Exception while starting compiler", ex);
169169
if (filePath.Contains("'"))
170170
{
171-
Log(LogType.Error, "Server directory path contains an apostrophe, compiler will not work until path is renamed");
171+
Interface.Oxide.LogError("Server directory path contains an apostrophe, compiler will not work until path is renamed");
172172
}
173173
else if (Environment.OSVersion.Platform == PlatformID.Unix)
174174
{
175-
Log(LogType.Error, "Compiler may not be set as executable; chmod +x or 0744/0755 required");
175+
Interface.Oxide.LogError("Compiler may not be set as executable; chmod +x or 0744/0755 required");
176176
}
177177

178178
if (ex.GetBaseException() != ex)
179179
{
180-
Log(LogType.Error, "BaseException: ", exception: ex.GetBaseException());
180+
Interface.Oxide.LogException("BaseException: ", ex.GetBaseException());
181181
}
182182

183183
Win32Exception win32 = ex as Win32Exception;
184184
if (win32 != null)
185185
{
186-
Log(LogType.Error, $"Win32 NativeErrorCode: {win32.NativeErrorCode} ErrorCode: {win32.ErrorCode} HelpLink: {win32.HelpLink}");
186+
Interface.Oxide.LogError($"Win32 NativeErrorCode: {win32.NativeErrorCode} ErrorCode: {win32.ErrorCode} HelpLink: {win32.HelpLink}");
187187
}
188188
}
189189

@@ -220,7 +220,7 @@ internal void Stop(bool synchronous, string reason)
220220

221221
if (!string.IsNullOrEmpty(reason))
222222
{
223-
Log(LogType.Warning, $"Shutting down compiler because {reason}");
223+
Interface.Oxide.LogInfo($"Shutting down compiler because {reason}");
224224
}
225225

226226
if (!endedProcess.HasExited)
@@ -230,11 +230,11 @@ internal void Stop(bool synchronous, string reason)
230230
{
231231
if (endedProcess.WaitForExit(10000))
232232
{
233-
Log(LogType.Info, "Compiler shutdown completed");
233+
Interface.Oxide.LogInfo("Compiler shutdown completed");
234234
}
235235
else
236236
{
237-
Log(LogType.Warning, "Compiler failed to gracefully shutdown, killing the process...");
237+
Interface.Oxide.LogWarning("Compiler failed to gracefully shutdown, killing the process...");
238238
endedProcess.Kill();
239239
}
240240

@@ -248,11 +248,11 @@ internal void Stop(bool synchronous, string reason)
248248
{
249249
if (endedProcess.WaitForExit(10000))
250250
{
251-
Log(LogType.Info, "Compiler shutdown completed");
251+
Interface.Oxide.LogInfo("Compiler shutdown completed");
252252
}
253253
else
254254
{
255-
Log(LogType.Warning, "Compiler failed to gracefully shutdown, killing the process...");
255+
Interface.Oxide.LogWarning("Compiler failed to gracefully shutdown, killing the process...");
256256
endedProcess.Kill();
257257
}
258258

@@ -313,7 +313,7 @@ private void OnMessage(ObjectStreamConnection<CompilerMessage, CompilerMessage>
313313

314314
if (compilablePlugin == null)
315315
{
316-
Log(LogType.Error, $"Unable to resolve script error to {fileName}: {error}");
316+
Interface.Oxide.LogError($"Unable to resolve script error to {fileName}: {error}");
317317
continue;
318318
}
319319

@@ -349,7 +349,7 @@ private void OnMessage(ObjectStreamConnection<CompilerMessage, CompilerMessage>
349349

350350
if (comp == null)
351351
{
352-
Log(LogType.Error, "Compiler returned a error for a untracked compilation", e);
352+
Interface.Oxide.LogException("Compiler returned a error for a untracked compilation", e);
353353
return;
354354
}
355355

@@ -458,18 +458,18 @@ private void EnqueueCompilation(Compilation compilation)
458458
{
459459
if (includedFiles.Contains(include))
460460
{
461-
Log(LogType.Warning, $"Tried to include {include} but it has already been added to the compilation");
461+
Interface.Oxide.LogWarning($"Tried to include {include} but it has already been added to the compilation");
462462
continue;
463463
}
464464

465465
CompilerFile includeFile = new CompilerFile(include);
466466
if (includeFile.Data == null || includeFile.Data.Length == 0)
467467
{
468-
Log(LogType.Warning, $"Ignoring plugin {includeFile.Name}, file is empty");
468+
Interface.Oxide.LogWarning($"Ignoring plugin {includeFile.Name}, file is empty");
469469
continue;
470470
}
471471

472-
Log(LogType.Info, $"Adding {includeFile.Name} to compilation project");
472+
Interface.Oxide.LogWarning($"Adding {includeFile.Name} to compilation project");
473473

474474
sourceFiles.Add(includeFile);
475475
includedFiles.Add(include);
@@ -481,7 +481,7 @@ private void EnqueueCompilation(Compilation compilation)
481481

482482
if (sourceFiles.Count == 0)
483483
{
484-
Log(LogType.Error, "Compilation job contained no valid plugins");
484+
Interface.Oxide.LogError("Compilation job contained no valid plugins");
485485
compilations.Remove(compilation.id);
486486
compilation.Completed();
487487
return;
@@ -542,17 +542,17 @@ private static bool SetFilePermissions(string filePath)
542542
}
543543
catch (Exception ex)
544544
{
545-
Log(LogType.Error, $"Unable to check {name} for executable permission", exception: ex);
545+
Interface.Oxide.LogException($"Unable to check {name} for executable permission", ex);
546546
}
547547
try
548548
{
549549
Syscall.chmod(filePath, FilePermissions.S_IRWXU);
550-
Log(LogType.Info, $"File permissions set for {name}");
550+
Interface.Oxide.LogInfo($"File permissions set for {name}");
551551
return true;
552552
}
553553
catch (Exception ex)
554554
{
555-
Log(LogType.Error, $"Could not set {filePath} as executable, please set manually", exception: ex);
555+
Interface.Oxide.LogException($"Could not set {filePath} as executable, please set manually", ex);
556556
}
557557
return false;
558558
}
@@ -573,7 +573,7 @@ private static bool DownloadFile(string url, string path, int retries = 3)
573573
}
574574
else
575575
{
576-
Log(LogType.Info, $"Downloading {fileName}. . .");
576+
Interface.Oxide.LogInfo($"Downloading {fileName}. . .");
577577
}
578578

579579
byte[] data;
@@ -582,7 +582,7 @@ private static bool DownloadFile(string url, string path, int retries = 3)
582582
if (!TryDownload(url, retries, ref retry, last, out data, out code, out newerFound, ref md5))
583583
{
584584
string attemptVerb = retries == 1 ? "attempt" : "attempts";
585-
Log(LogType.Error, $"Failed to download {fileName} after {retry} {attemptVerb} with response code '{code}', please manually download it from {url} and save it here {path}");
585+
Interface.Oxide.LogError($"Failed to download {fileName} after {retry} {attemptVerb} with response code '{code}', please manually download it from {url} and save it here {path}");
586586
return false;
587587
}
588588

@@ -598,14 +598,14 @@ private static bool DownloadFile(string url, string path, int retries = 3)
598598
fs.Write(data, 0, data.Length);
599599
}
600600

601-
Log(LogType.Info, $"Latest version of {fileName} has been downloaded");
601+
Interface.Oxide.LogInfo($"Latest version of {fileName} has been downloaded");
602602
}
603603

604604
return true;
605605
}
606606
catch (Exception e)
607607
{
608-
Log(LogType.Error, $"Unexpected error occurred while trying to download {fileName}, please manually download it from {url} and save it here {path}", exception: e);
608+
Interface.Oxide.LogException($"Unexpected error occurred while trying to download {fileName}, please manually download it from {url} and save it here {path}", e);
609609
return false;
610610
}
611611
}

0 commit comments

Comments
 (0)