2 CLOG How To
Anthony Rossi редактировал(а) эту страницу 2020-08-19 21:36:16 -07:00

CLOG

https://github.com/microsoft/CLOG

Open Source, cross-platform tool to generate logging/tracing code, using printf() style event descriptions

MsQuic uses CLOG to dynamically generate logging information used to build cross-platform logging into the product. TODO - Add more info

Development

Adding New Events

When adding new events, you should initially get an error. For instance, when adding the following event:

QuicTraceLogConnInfo(
    PeerPreferredAddress,
    Connection,
    "Peer configured preferred address %!SOCKADDR!",
    CLOG_BYTEARRAY(sizeof(Connection->PeerTransportParams.PreferredAddress), &Connection->PeerTransportParams.PreferredAddress));

You will get the following error:

Sidecar is dirty
Config Changed : Inserting : PeerPreferredAddress
Config Changed : Added New Event: PeerPreferredAddress
: fatal error CLOG25: Wont write while in readonly mode.  --readOnly was specified as a command line argument.  If you're in a development mode, you can set the environment CLOG_DEVELOPMENT_MODE such that manifests and sidecars will be automatically updated
   Info : WontWriteWhileInReadonlyMode:SideCar
src/core/CMakeFiles/core.clog.dir/build.make:106: recipe for target 'inc/core.clog/connection.c.clog.h' failed

This error indicates the sidecar needs to be updated before the build will pass. The best way to accomplish this (currently) is to set the UpdateClog flag and rebuild:

./scripts/build.ps1 -UpdateClog