-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Debug utility #233
Debug utility #233
Conversation
0286076
to
b049602
Compare
@@ -16,6 +18,8 @@ import DropdownItem from './DropdownItem' | |||
import DropdownMenu from './DropdownMenu' | |||
import Icon from '../../elements/Icon/Icon' | |||
|
|||
const debug = makeDebugger('dropdown') |
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.
Logs are auto namespaced to stardust:<your-name>
b049602
to
5c14e4b
Compare
// }, {})) | ||
debug.groupCollapsed('componentDidUpdate()') | ||
debug('changed props:', objectDiff(nextProps, this.props)) | ||
debug.groupEnd() |
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.
console methods group
, groupCollapsed
, and groupEnd
are added for cleaner console activity.
Couple of thoughts:
debug(() => object.diff(...)) The above is a solution if the following is not an option
|
Agreed on all counts and considered these things prior to the PR. In the future we'll have an optimization phase which will include a transform to remove debugs, static propTypes, and static_meta from production code. I want to get more components moved to the 1.0 pattern before optimizing further. This PR moves us from console statements to a debug pattern we can iterate on. |
This PR addresses the TODO in #206 to add a logging utility. It is only used in the Dropdown for now as the Dropdown is our proving grounds for removing jQuery and setting our v1.0.0 precedence.
Two debug logs were generating object differences, see
componentWillReceiveProps
andcomponentDidUpdate
. This logic was pulled into anobjectDiff
util and tested.