dmlc / dmlc-core

A common bricks library for building scalable and portable distributed machine learning.
Apache License 2.0
861 stars 518 forks source link

Allow the user to furnish their own CHECK() and LOG() macros #639

Closed tkonolige closed 3 years ago

tkonolige commented 3 years ago

This make DMLC compatible with libraries that do not want to use DMLC's builtin logging facilities. If DMLC_USE_LOGGING_LIBRARY is defined, it will be used in place of the builtin library. This definition must point to an include path like <my/logging.h>.

tkonolige commented 3 years ago

@hcho3 DMLC_LOG_CUSTOMIZE only allows customization of LOG(INFO) and only allows the user to change the method in which the message is printed. My use case is changing the formatting of the log message (specifically the backtrace portion) which is not possible with DMLC_LOG_CUSTOMIZE.

hcho3 commented 3 years ago

@tkonolige Does this PR remove the definition of LOG completely? Is the user expected to furnish a new implementation for LOG macro from scratch?

hcho3 commented 3 years ago

Related: https://discuss.tvm.apache.org/t/rfc-line-numbers-in-backtraces/8711. After reading the thread, I was able to better understand the motivation of this PR.

tkonolige commented 3 years ago

@hcho3 exactly. The user will have to implement their own LOG and CHECK functionality.

Thanks for linking that thread. It provides good context.

hcho3 commented 3 years ago

@trivialfis You might be interested in this PR. It might help simplify the logging system in XGBoost.

tkonolige commented 3 years ago

@hcho3 Thanks for the feedback, I've incorporated your changes to the documentation.

tqchen commented 3 years ago

@hcho3 @junrushao1994 please take another look, will merge in a day if no further comment