Replies: 3 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.
-
|
For reference: I recently consolidated/removed a few of the oddball logging functions. In particular:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Plasma has
plStatusLogas 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 globalfLoggingOffflag, but nothing really uses it.hsStatusMessagegoes toplasmadbg.login internal builds. It's compile-time-disabled in external builds.hsDebugMessagegoes toplasmadbg.login debug builds. It's compile-time-disabled in release builds.pnAcLog(globalLogMsgfunction) goes toOLD_ASYNC_LOG.log. It accepts a severity level, which is entirely ignored.plResManagerlogs toresources.log. It implements a simple log level system with conditional logging.plNetClientMgr::Loggoes tonetwork.log(and conditionally also tohsStatusMessageandplNetObjectDebugger).plLoggable(base class ofplNetClientMgr) adds a simple log level system on top of this.plNetApp::Static*Msggoes here.plNetClientStatsRecordergoes toStatsRecorder.log.plNetClientStreamRecordergoes toStreamRecorder.log.plDetectorLoggoes toDetector.log. It adds a simple log level system.plKickableLoggoes toKickables.login internal builds withUSE_KICKABLE_LOGdefined. It adds a simple log color system.plPXErrorHandlertranslates PhysX error codes/messages and logs them toSimulation.log.plSimulationManagerlogs toSimulation.log. It adds a very simple log color system.plWaveSet7::Loggoes toTexWavesin the log drawer (no .log file).plDXPipeline::IAddErrorMessagegoes topipeline.log.plEAXListener::IFaillogs toaudio.log. It distinguishes between "major" and not-"major" errors.plSound::IPrintDbgMessagegoes toaudio.log. It distinguishes between errors and not-errors.LocalizationXMLFile::AddErrorgoes toLocalizationDataMgr.log.pfPatcher'sPatcherLog*go topatcher.log. It adds a simple log color system.Python.log.PtDebugPrintgoes topython.log. It adds a log level system that allows conditional logging.plVirtualCamNeulogs tocamLog.txtin internal builds, bypassingplStatusLog.DebugMsggoes to stderr, and on Windows also toOutputDebugString.DEBUG_MSGis the same, but compile-time-disabled in release builds.hsRefCnt'sREFCOUNT_DBG_REFSdebug output goes here.plNetObjectDebugger::LogMsggoes 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::CreateStatusLogto set up a reusableplStatusLoginstance?plStatusLog::AddLineSdirectly?PtDebugPrintor 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 intoplStatusLogitself 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