You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment there is a community requirement to prefix all the log messages with additional information like timestamp, line number, severity level, etc.
Here's an example
2019-03-19 11:23:57.776 <ZWEAGW1:threadInformation> userID INFO (locationInformation) ZWEA001I Message text
The existing logging facility has the ability to use a custom formatter but the caller cannot pass the context information to it (e.g. the line number). The purpose of this ticket is to discuss how we could re-factor/extend the code in logging.c to meet the new requirements while keeping backward compatibility.
Details
The current logging function has the following signature:
One possible solution would be making this a macro and changing the original zowelog to have file name and line number arguments. The issues are: making this a macro may break existing code, the formatter (or log handler) will also have to change.
typedefvoid (*LogHandler2)(structLoggingContext_tag*context,
LoggingComponent*component,
void*componentData, // IF: set in existing logConfigureDestination or logConfigureDestination2void*userData, // IF: set in the new function logConfigureDestination3char*formatString,
va_listargList);
LoggingDestination will need to have a new field - handler2
typedefstructLoggingDestination_tag{
chareyecatcher[8]; /* RSLOGDST */intid;
intstate;
char*name;
void*data; /* used by destination to hold internal state */LogHandlerhandler;
DataDumperdumper;
LogHandler2handler2;
} LoggingDestination;
zowelog2 will have the same implementation as zowelog except for the handler call
zowelogx will have to do some work before actually testing whether we need to log (hopefully the compiler can optimize the fileAndLine initialization
If the code with the old version of the loggin facility calls a shared library that uses the new one, the new code will try to check handler2 which doesn't exist in the old LoggingDestination in the caller code. We may possible carve out some bytes out of the LoggingDestination->eyecatcher field and create a flag or version field which could be tested by the new version.
The text was updated successfully, but these errors were encountered:
Overview
At the moment there is a community requirement to prefix all the log messages with additional information like timestamp, line number, severity level, etc.
Here's an example
The existing logging facility has the ability to use a custom formatter but the caller cannot pass the context information to it (e.g. the line number). The purpose of this ticket is to discuss how we could re-factor/extend the code in
logging.c
to meet the new requirements while keeping backward compatibility.Details
The current logging function has the following signature:
One possible solution would be making this a macro and changing the original
zowelog
to have file name and line number arguments. The issues are: making this a macro may break existing code, the formatter (or log handler) will also have to change.Possible fix 1
zowelog2
LoggingDestination
will need to have a new field -handler2
zowelog2
will have the same implementation aszowelog
except for the handler call__FILE__
and__LINE__
Drawbacks of fix 1:
zowelogx
will have to do some work before actually testing whether we need to log (hopefully the compiler can optimize thefileAndLine
initializationhandler2
which doesn't exist in the oldLoggingDestination
in the caller code. We may possible carve out some bytes out of theLoggingDestination->eyecatcher
field and create a flag or version field which could be tested by the new version.The text was updated successfully, but these errors were encountered: