--[[ Optional run logging for support. When the pref is on, LrLogger writes
to Lightroom's standard log folder (Documents/lrClassicLogs/CutCorners.log)
so a user can attach it to a support mail. The 'logfile' action is chosen at
require time, so toggling the pref takes effect on plugin reload. ]]

local LrLogger = import 'LrLogger'
local LrPrefs = import 'LrPrefs'

local prefs = LrPrefs.prefsForPlugin()

local logger = LrLogger('CutCorners')
if prefs.enableLogging then
	logger:enable('logfile')
end

local Log = {}

function Log.info(fmt, ...)
	logger:info(select('#', ...) > 0 and string.format(fmt, ...) or fmt)
end

function Log.warn(fmt, ...)
	logger:warn(select('#', ...) > 0 and string.format(fmt, ...) or fmt)
end

return Log
