js-sdk icon indicating copy to clipboard operation
js-sdk copied to clipboard

Create New Logging level uitlities

Open joshLong145 opened this issue 1 year ago • 5 comments

New Logging utilities within packages/misc will help create granular logging within sdk packages. the current log, logError, logWithRequestId and logErrorWithRequestId should be renamed to indicate it is logging under debug, changing the name to logDebug logDebugWithRequestId.

The following levels should be implemented.

  • Info
  • Trace
  • Warn

You can find current implementations of logging utilities below: log logWithRequestId

The above implementations use our logger package

see here for how we initialize a instance of our logging:

We should implement explicit logging utilities for the above categories supported in our logging package

  • logInfo
  • logInfoWithRequestId
  • logTrace
  • logTraceWithRequestId
  • logWarn
  • logWarnWithRequestId

joshLong145 avatar Jan 16 '24 14:01 joshLong145

@joshLong145 - I can look at this if you want to assign to me

cipherzzz avatar Jan 20 '24 19:01 cipherzzz

@cipherzzz sure! is now assigned to you. :)

joshLong145 avatar Jan 23 '24 01:01 joshLong145

Thanks @joshLong145 - I will get on it!

cipherzzz avatar Jan 24 '24 10:01 cipherzzz

@joshLong145

Hey! just for clarification, Are you saying that you want the following methods to have versions of each level of logging as a convenience mechanism within packages/misc?

Current Methods

  • log
  • logError
  • logWithRequestId
  • logErrorWithRequestId

Log Levels

  • Debug
  • Info
  • Trace
  • Warn
  • Error?

New Methods

Debug

  • logDebug
  • logDebugWithRequestId
console.log()

Info

  • logWarn
  • logWarnWithRequestId
console.info()

Trace

  • logTrace
  • logTraceWithRequestId
console.trace()

Warn

  • logWarn
  • logWarnWithRequestId
console.warn()

Error

  • logError
  • logErrorWithRequestId
console.error()

cipherzzz avatar Jan 24 '24 21:01 cipherzzz

@cipherzzz You are correct in your understanding. However we have our own logging package which we should use over console I updated the description of the issue to link to our logging package and where the misc package wraps some of the implementations.

This task does not extend to using the new logging utilities. but if you want to try out writing a configuration interface for the logging to replace the debug flag in our LitNodeClient

joshLong145 avatar Jan 25 '24 13:01 joshLong145

Closing due to inactivity

Ansonhkg avatar Jul 17 '24 09:07 Ansonhkg