You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please forgive me if this is already available. I did search issues, PR's, and code but did not see a way to handle this.
Is your feature request related to a problem? Please describe.
The problem I would like to solve is two fold.
1 - I would like to allow more verbose logging in the production build. I understand how/why the debug and verbose logging are removed from the production build. But, I have a staging environment where I would like to be able to view the logs of the users in that environment.
2 - I would like to be able to "toast" (or in some way display) matched sequences and display their keyMap data. This may also help alleviate the problem 1. For example, toast("You pressed ${sequence} - ${name}, ${description}"). Even though verbose/debug logging is disabled in the production build and this would not be as detailed, I can get what I need out of this.
Describe the solution you'd like
Allow the user to pass in a log property (or perhaps onMatched is a better name? This could technically be used for cases other than logging) to the config function. This log property would be a function with the signature (keyMapData) => {}. It would be up to the developer to do whatever they want with this data. And this would be called somewhere around
Describe alternatives you've considered
Problem 1 - I have considered requiring different builds based on my own environment setting. But I am unclear of to get the development build?
Problem 2 - There are not really any alternatives. I have considered manually logging in the handlers functions, but those functions only have access to the event, not the matched keyMapData
Additional context
An example
configure({log: (keyMapData)=>{if(MY_ENV!=='production'){// Allows me to view some basic hotkeys info// in staging, testing, dev environments.myLogger.log(keyMapData);}// I could also choose to display this info to the userconstmessage=`You pressed ${keyMapData.sequence} - ${keyMapData.name}, ${keyMapData.description}`toast.info(message);// Maybe I could encode some "level" in the group like "warn:list"const[level,group]=keyMapData.group.split(':');toast[level](message);}})
The text was updated successfully, but these errors were encountered:
Please forgive me if this is already available. I did search issues, PR's, and code but did not see a way to handle this.
Is your feature request related to a problem? Please describe.
The problem I would like to solve is two fold.
1 - I would like to allow more verbose logging in the production build. I understand how/why the
debug
andverbose
logging are removed from the production build. But, I have astaging
environment where I would like to be able to view the logs of the users in that environment.2 - I would like to be able to "toast" (or in some way display) matched sequences and display their
keyMap
data. This may also help alleviate the problem 1. For example,toast("You pressed ${sequence} - ${name}, ${description}")
. Even though verbose/debug logging is disabled in the production build and this would not be as detailed, I can get what I need out of this.Describe the solution you'd like
Allow the user to pass in a
log
property (or perhapsonMatched
is a better name? This could technically be used for cases other than logging) to theconfig
function. Thislog
property would be a function with the signature(keyMapData) => {}
. It would be up to the developer to do whatever they want with this data. And this would be called somewhere aroundreact-hotkeys/src/lib/matching/ActionResolver.js
Line 183 in 9974edc
Another approach would be to allow an
onMatched
callback tohandler
functions. For example,Describe alternatives you've considered
Problem 1 - I have considered requiring different builds based on my own environment setting. But I am unclear of to get the development build?
Problem 2 - There are not really any alternatives. I have considered manually logging in the
handlers
functions, but those functions only have access to theevent
, not the matchedkeyMapData
Additional context
An example
The text was updated successfully, but these errors were encountered: