BeamMP / BeamMP-Server

Server for the multiplayer mod BeamMP for BeamNG.drive
https://beammp.com
GNU Affero General Public License v3.0
116 stars 49 forks source link

Add lua logging facilities as Util.Log*() functions #309

Closed lionkor closed 1 month ago

lionkor commented 2 months ago
Util.LogInfo("Hello, World!")
Util.LogWarn("Cool warning")
Util.LogError("Oh no!")
Util.LogDebug("hi")

now produces

[19/04/24 11:06:50.142] [Test] [INFO] Hello, World!    
[19/04/24 11:06:50.142] [Test] [WARN] Cool warning    
[19/04/24 11:06:50.142] [Test] [ERROR] Oh no!
[19/04/24 11:06:50.142] [Test] [DEBUG] hi

where Test is the lua state id.

Neptnium commented 2 months ago

Works for me with the build provided by @lionkor !

Starystars67 commented 2 months ago

I like the idea of this! Maybe a DEBUG option would be good too?

Neptnium commented 2 months ago

@Starystars67 I agree with that, but in that case, it would be nice if the debug log (maybe Util.LogDebug) would show up only if Debug = true in the server's config file, what do you guys think about this ?

lionkor commented 2 months ago

Solid idea, thank you!