aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/commands.coffee
diff options
context:
space:
mode:
authorStephen Blott2016-01-31 07:39:04 +0000
committerStephen Blott2016-01-31 07:39:04 +0000
commiteba184604678dbc11fffa04c8fe05ff537a50e36 (patch)
treeed60cb1d60f1b3340d7815d0de69548c3004a082 /background_scripts/commands.coffee
parent91fb337c9d92f6291ef42c55c4d29ca35b710203 (diff)
downloadvimium-eba184604678dbc11fffa04c8fe05ff537a50e36.tar.bz2
Add a basic log page; tweaks.
This tweaks @mrmr1993's logging ideas discussed in #1629: - Do not generate log entries from the logging page itself. - Use the logger for *all* logging (including from `commands.coffee`, and from `bgLog`). @mrmr1993's original idea is 91fb337c9d92f6291ef42c55c4d29ca35b710203.
Diffstat (limited to 'background_scripts/commands.coffee')
-rw-r--r--background_scripts/commands.coffee8
1 files changed, 4 insertions, 4 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee
index c8121a96..50306c35 100644
--- a/background_scripts/commands.coffee
+++ b/background_scripts/commands.coffee
@@ -13,7 +13,7 @@ Commands =
# command passed to it. This is used to implement e.g. "closing of 3 tabs".
addCommand: (command, description, options) ->
if command of @availableCommands
- console.log(command, "is already defined! Check commands.coffee for duplicates.")
+ logMessage? "#{command} is already defined! Check commands.coffee for duplicates."
return
options ||= {}
@@ -26,7 +26,7 @@ Commands =
mapKeyToCommand: ({ key, command, options }) ->
unless @availableCommands[command]
- console.log command, "doesn't exist!"
+ logMessage? "#{command} doesn't exist!"
return
options ?= []
@@ -55,13 +55,13 @@ Commands =
[ _, key, command, options... ] = tokens
if command? and @availableCommands[command]
key = @normalizeKey key
- console.log "Mapping", key, "to", command
+ logMessage? "Mapping #{key} to #{command}"
@mapKeyToCommand { key, command, options }
when "unmap"
if tokens.length == 2
key = @normalizeKey tokens[1]
- console.log "Unmapping", key
+ logMessage? "Unmapping #{key}"
delete @keyToCommandRegistry[key]
when "unmapAll"