Replies: 2 comments
-
I've used One issue that we ran into when trying to get rid of the pnAcLog and OLD_ASYNC_LOG stuff is that plStatusLog is in PubUtilLib and not NucleusLib. |
Beta Was this translation helpful? Give feedback.
-
I've been meaning to answer this for awhile, but so much to do, so little time. These are all good observations and questions, so I'll answer the questions with my personal preferences.
I generally use
Probably manually set up the log with
This is a bit of a judgement call - some logs are particularly spammy or only useful during development. These are the ones that I would tend to compile out, eg the kickable log. Given that we are not a paid game and aren't really trying to hide what goes on under the hood, though, I don't see why we should over zealously compile out logging. |
Beta Was this translation helpful? Give feedback.
-
Plasma has
plStatusLog
as its main central logging system, but there are also lots of little logging helper functions built on top of it. A few places also do their own custom logging withoutplStatusLog
.I tried to make a list to figure out which logging APIs exist, how they relate to each other, and what they do differently. There's quite a few of them and I probably missed some.
List of logging APIs
plStatusLog
: Outputs to .log files in the Log folder, and for internal clients also to the in-game "log drawer" window. Allows setting the color of each log line, but they're only visible in the "log drawer" and not in the .log files, so they're of limited use as log levels. Has a globalfLoggingOff
flag, but nothing really uses it.hsStatusMessage
goes toplasmadbg.log
in internal builds. It's compile-time-disabled in external builds.hsDebugMessage
goes toplasmadbg.log
in debug builds. It's compile-time-disabled in release builds.pnAcLog
(globalLogMsg
function) goes toOLD_ASYNC_LOG.log
. It accepts a severity level, which is entirely ignored.plResManager
logs toresources.log
. It implements a simple log level system with conditional logging.plNetClientMgr::Log
goes tonetwork.log
(and conditionally also tohsStatusMessage
andplNetObjectDebugger
).plLoggable
(base class ofplNetClientMgr
) adds a simple log level system on top of this.plNetApp::Static*Msg
goes here.plNetClientStatsRecorder
goes toStatsRecorder.log
.plNetClientStreamRecorder
goes toStreamRecorder.log
.plDetectorLog
goes toDetector.log
. It adds a simple log level system.plKickableLog
goes toKickables.log
in internal builds withUSE_KICKABLE_LOG
defined. It adds a simple log color system.plPXErrorHandler
translates PhysX error codes/messages and logs them toSimulation.log
.plSimulationManager
logs toSimulation.log
. It adds a very simple log color system.plWaveSet7::Log
goes toTexWaves
in the log drawer (no .log file).plDXPipeline::IAddErrorMessage
goes topipeline.log
.plEAXListener::IFail
logs toaudio.log
. It distinguishes between "major" and not-"major" errors.plSound::IPrintDbgMessage
goes toaudio.log
. It distinguishes between errors and not-errors.LocalizationXMLFile::AddError
goes toLocalizationDataMgr.log
.pfPatcher
'sPatcherLog*
go topatcher.log
. It adds a simple log color system.Python.log
.PtDebugPrint
goes topython.log
. It adds a log level system that allows conditional logging.plVirtualCamNeu
logs tocamLog.txt
in internal builds, bypassingplStatusLog
.DebugMsg
goes to stderr, and on Windows also toOutputDebugString
.DEBUG_MSG
is the same, but compile-time-disabled in release builds.hsRefCnt
'sREFCOUNT_DBG_REFS
debug output goes here.plNetObjectDebugger::LogMsg
goes here.OutputDebugString
.[f]printf
,[f]puts
,cout
/cerr
,ST::printf
, ...This is all a bit confusing from a developer perspective, especially when new to the codebase. Questions I've asked myself:
DebugMsg
?DEBUG_MSG
?hsDebugMessage
?hsStatusMessage
,plAcLog
)?plStatusLogMgr::CreateStatusLog
to set up a reusableplStatusLog
instance?plStatusLog::AddLineS
directly?PtDebugPrint
or just standardprint
?I'm also wondering why all of these different logging helpers exist in the first place - or if they are mostly just legacy code. A common pattern in these helper functions is to build on
plStatusLog
, but hardcode the log file name and add compile-time conditional logging and/or multiple methods for different log levels/colors. Perhaps those features should be integrated intoplStatusLog
itself somehow, so that not every place that wants log levels or conditional logging has to reimplement them manually?For reference, some past work on the logging infrastructure:
Beta Was this translation helpful? Give feedback.
All reactions