-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zowelog zss format handler #126
base: v1.x/staging
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,14 +93,34 @@ ZOWE_PRAGMA_PACK_RESET | |
#define LOG_COMP_RESTDATASET 0x008F0001000E0000LLU | ||
#define LOG_COMP_RESTFILE 0x008F0001000F0000LLU | ||
|
||
|
||
#define LOG_COMP_TEXT_ALLOC "alloc" | ||
#define LOG_COMP_TEXT_UTILS "utils" | ||
#define LOG_COMP_TEXT_COLLECTIONS "collections" | ||
#define LOG_COMP_TEXT_SERIALIZATION "serialization" | ||
#define LOG_COMP_TEXT_ZLPARSER "zlparser" | ||
#define LOG_COMP_TEXT_ZLCOMPILER "zlcompiler" | ||
#define LOG_COMP_TEXT_ZLRUNTIME "zlruntime" | ||
#define LOG_COMP_TEXT_STCBASE "stcbase" | ||
#define LOG_COMP_TEXT_HTTPSERVER "httpserver" | ||
#define LOG_COMP_TEXT_DISCOVERY "discovery" | ||
#define LOG_COMP_TEXT_DATASERVICE "dataservice" | ||
#define LOG_COMP_TEXT_CMS "cms" | ||
#define LOG_COMP_TEXT_LPA "lpa" | ||
#define LOG_COMP_TEXT_RESTDATASET "restdataset" | ||
#define LOG_COMP_TEXT_RESTFILE "restfile" | ||
|
||
#define LOG_DEST_DEV_NULL 0x008F0000 | ||
#define LOG_DEST_PRINTF_STDOUT 0x008F0001 | ||
#define LOG_DEST_PRINTF_STDERR 0x008F0002 | ||
|
||
struct LoggingContext_tag; | ||
|
||
typedef void (*LogHandler)(struct LoggingContext_tag *context, | ||
LoggingComponent *component, | ||
LoggingComponent *component, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This breaks all the code that uses logging, we shouldn't make such changes in minor releases. If you kept compatibility you wouldn't have to change the cross memory code. Imagine that someone uses this API, do they now need to change their code? What about binaries? You will break existing plugins because you'll call theirs handler assuming it's something else. Please reconsider this design. You may want to introduce another handler type, allow new code to set it and check at runtime whether you need to caller the old handler type or the new one. That way you don't have to change so much code and break old existing code. Same applies to the dump function. |
||
char* path, int line, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not mix tabs and spaces. This applies to all the changes in this PR. |
||
int level, | ||
uint64 compID, | ||
void *data, | ||
char *formatString, | ||
va_list argList); | ||
|
@@ -297,15 +317,23 @@ bool logShouldTraceInternal(LoggingContext *context, uint64 componentID, int lev | |
|
||
/* this log message will be sent to the destination associated to the component | ||
*/ | ||
void _zowelog(LoggingContext *context, uint64 compID, char* path, int line, int level, char *formatString, ...); | ||
void _zowedump(LoggingContext *context, uint64 compID, int level, void *data, int dataSize, char* path, int line); | ||
|
||
void zowelog(LoggingContext *context, uint64 compID, int level, char *formatString, ...); | ||
void zowedump(LoggingContext *context, uint64 compID, int level, void *data, int dataSize); | ||
|
||
char *standardDumperFunction(char *workBuffer, int workBufferSize, | ||
void *data, int dataSize, int lineNumber); | ||
#define LOGCHECK(context,component,level) \ | ||
((component > MAX_LOGGING_COMPONENTS) ? \ | ||
(context->applicationComponents[component].level >= level) : \ | ||
(context->coreComponents[component].level >= level) ) | ||
|
||
|
||
#define zowelog(context, compID, level, formatString, ...) \ | ||
_zowelog(context, compID, __FILE__, __LINE__, level, formatString, ##__VA_ARGS__); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By introducing a macro we will break existing plugins because they assume that zowelog has fewer args. It may be better to have |
||
|
||
#define zowedump(context, compID, level, data, dataSize) \ | ||
_zowedump(context, compID, level, data, dataSize, __FILE__, __LINE__); | ||
|
||
LoggingDestination *logConfigureDestination(LoggingContext *context, | ||
unsigned int id, | ||
char *name, | ||
|
@@ -332,8 +360,8 @@ int logGetLevel(LoggingContext *context, uint64 compID); | |
extern int logSetExternalContext(LoggingContext *context); | ||
extern LoggingContext *logGetExternalContext(); | ||
|
||
void printStdout(LoggingContext *context, LoggingComponent *component, void *data, char *formatString, va_list argList); | ||
void printStderr(LoggingContext *context, LoggingComponent *component, void *data, char *formatString, va_list argList); | ||
void printStdout(LoggingContext *context, LoggingComponent *component, char* path, int line, int level, uint64 compID, void *data, char *formatString, va_list argList); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not change existing APIs. |
||
void printStderr(LoggingContext *context, LoggingComponent *component, char* path, int line, int level, uint64 compID, void *data, char *formatString, va_list argList); | ||
|
||
#endif | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you
strcat
into a string literal? Have you tested this code? I would expect an S0C4.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! it's a buffer overflow into the literal pool! Unfortunately, it may not ABEND, it will just clobber the literal pool.
strcat
is a code smell and should never be used.