mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
EvernoteOAuth set logger (#6308)
evernote-sdk-lua#4 to logger.dbg, instead of default print
This commit is contained in:
@@ -7,9 +7,9 @@ local DataStorage = require("datastorage")
|
||||
local DocSettings = require("docsettings")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local Screen = require("device").screen
|
||||
local logger = require("logger")
|
||||
local util = require("ffi/util")
|
||||
local Device = require("device")
|
||||
local DEBUG = require("dbg")
|
||||
local JoplinClient = require("JoplinClient")
|
||||
local T = require("ffi/util").template
|
||||
local _ = require("gettext")
|
||||
@@ -405,6 +405,7 @@ function EvernoteExporter:doLogin(username, password)
|
||||
domain = self.evernote_domain,
|
||||
username = username,
|
||||
password = password,
|
||||
logger = logger.dbg,
|
||||
}
|
||||
self.evernote_username = username
|
||||
local ok, token = pcall(oauth.getToken, oauth)
|
||||
@@ -486,7 +487,7 @@ function EvernoteExporter:updateHistoryClippings(clippings, new_clippings)
|
||||
or clippings[title][chapter_index][note_index].time ~= note.time
|
||||
or clippings[title][chapter_index][note_index].text ~= note.text
|
||||
or clippings[title][chapter_index][note_index].note ~= note.note then
|
||||
DEBUG("found new notes in history", booknotes.title)
|
||||
logger.dbg("found new notes in history", booknotes.title)
|
||||
clippings[title] = booknotes
|
||||
end
|
||||
end
|
||||
@@ -500,7 +501,7 @@ function EvernoteExporter:updateMyClippings(clippings, new_clippings)
|
||||
-- since appending is the only way to modify notes in My Clippings
|
||||
for title, booknotes in pairs(new_clippings) do
|
||||
if clippings[title] == nil or #clippings[title] < #booknotes then
|
||||
DEBUG("found new notes in MyClipping", booknotes.title)
|
||||
logger.dbg("found new notes in MyClipping", booknotes.title)
|
||||
clippings[title] = booknotes
|
||||
end
|
||||
end
|
||||
@@ -539,7 +540,7 @@ function EvernoteExporter:exportAllNotes()
|
||||
clippings[title] = nil
|
||||
end
|
||||
end
|
||||
--DEBUG("clippings", clippings)
|
||||
--logger.dbg("clippings", clippings)
|
||||
self:exportClippings(clippings)
|
||||
self.config:saveSetting("clippings", clippings)
|
||||
self.config:flush()
|
||||
@@ -606,11 +607,11 @@ function EvernoteExporter:exportClippings(clippings)
|
||||
NetworkMgr:promptWifiOn()
|
||||
return
|
||||
elseif not ok and err then
|
||||
DEBUG("Error occurs when exporting book:", title, err)
|
||||
logger.dbg("Error while exporting book", title, err)
|
||||
error_count = error_count + 1
|
||||
error_title = title
|
||||
elseif ok then
|
||||
DEBUG("Exported notes in book:", title)
|
||||
logger.dbg("Exported notes in book:", title)
|
||||
export_count = export_count + 1
|
||||
export_title = title
|
||||
booknotes.exported[exported_stamp] = true
|
||||
@@ -648,7 +649,7 @@ function EvernoteExporter:exportBooknotesToEvernote(client, title, booknotes)
|
||||
booknotes = booknotes,
|
||||
notemarks = self.notemarks,
|
||||
})
|
||||
--DEBUG("content", content)
|
||||
--logger.dbg("content", content)
|
||||
local note_guid = client:findNoteByTitle(title, self.notebook_guid)
|
||||
local resources = {}
|
||||
for _, chapter in ipairs(booknotes) do
|
||||
@@ -674,7 +675,7 @@ function EvernoteExporter:exportBooknotesToHTML(title, booknotes)
|
||||
booknotes = booknotes,
|
||||
notemarks = self.notemarks,
|
||||
})
|
||||
--DEBUG("content", content)
|
||||
--logger.dbg("content", content)
|
||||
local html = io.open(self.clipping_dir .. "/" .. title .. ".html", "w")
|
||||
if html then
|
||||
html:write(content)
|
||||
|
||||
Reference in New Issue
Block a user