Skip to content

Commit

Permalink
chore: more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed May 12, 2019
1 parent a4a7f52 commit 60a8941
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/bookmarkParser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { exec } = require('child_process');
const readdirAsync = Promise.promisify(fs.readdir);
const execAsync = Promise.promisify(exec);

function bookmarkParser(version = 'default') {
function bookmarkParser(version = 'default', pluginContext) {
let filePath;
switch (os.type()) {
case 'Windows_NT':
Expand All @@ -31,7 +31,11 @@ function bookmarkParser(version = 'default') {
.then(files => files.sort().reverse()[0])
.then(filename => {
filePath = path.join(filePath, filename);
return execAsync(`${__dirname}/mozlz4 ${filePath.replace(' ', '\\ ')}`)
const shellCommandToReadData = `${__dirname}/mozlz4 ${filePath.replace(' ', '\\ ')}`;
pluginContext.console.log('warn', 'parsing mozlz4', {
shellCommandToReadData,
});
return execAsync(shellCommandToReadData)
.then(JSON.parse)
.then(content => ({ filename, content }));
});
Expand Down
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function firefoxBookmarkSearch(pluginContext) {
pluginContext.console.log('warn', 'reading profile', {
from: profilePath || 'default profile path',
});
return bookmarkParser(profilePath).then(({ filename, content }) => {
return bookmarkParser(profilePath, pluginContext).then(({ filename, content }) => {
pluginContext.console.log('warn', 'profile loaded', {
filename,
});
Expand All @@ -26,6 +26,9 @@ function firefoxBookmarkSearch(pluginContext) {
icon: iconuri || 'fa-bookmark',
id: `${lastModified}-${index}`,
}));
pluginContext.console.log('warn', 'get result [0]', {
firstItem: resultItems[0],
});
return resultItems;
});
};
Expand Down

0 comments on commit 60a8941

Please sign in to comment.