Closed yoichiro closed 4 years ago
After I received some comments from committers, I thought deeply about whether this feature is really necessary or not. As the result, I reached the recognition that current log outputs are for debug of the SDK itself. That is, I think that I should introduce another mechanism to output logs for analytics and so on rather than I change current log output logic. I close this pull request and the related issue. Thank you for the comments and reviewing!
Fixes #337
Abstract
This pull request provides a new feature to set own custom logger module.
Detail
This pull request has some modifications like the following:
common
module. This pull request removes them from thecommon
module. Instead, this pull request introduces a new module named 'logging'.logging
module defines three elements:Logger
interface,DefaultLogger
class andLoggerProxy
class.Logger
interface defines each log function signature includingdebug
,error
,info
,warn
anddeprecate
.DefaultLogger
class has same features which the currentcommon
module is providing.LoggerProxy
class is a proxy class. Actually, thelogging
module exports this instance namedlogger
. TheLoggerProxy
class delegates each function call to the implementation instance. TheDefaultLogger
class is one of the implementation, and the initialLoggerProxy
instance has theDefaultLogger
instance so that this client library can provide same behaviors of the latest version.common.<debug, error, warn, info>()
are replaced withlogging.<debug, error, warn, info>()
.Developers can define own custom logger with the
Logger
interface like the following:And, the developers can specify the own logger above with like the following: