From eba184604678dbc11fffa04c8fe05ff537a50e36 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 31 Jan 2016 07:39:04 +0000 Subject: 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. --- background_scripts/commands.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'background_scripts/commands.coffee') 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" -- cgit v1.2.3