Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new logging framework consistently #1459

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
[#1440](https://github.com/nextcloud/cookbook/pull/1440) @christianlupus
- Fix the build environment after regression
[#1442](https://github.com/nextcloud/cookbook/pull/1442) @christianlupus
- Use logging framework throughout the complete app
[1459](https://github.com/nextcloud/cookbook/pull/1459) @MarcelRobitaille

## Documentation
- Fixed some issues in the API description
Expand Down
8 changes: 4 additions & 4 deletions src/components/AppMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ export default {
}
},
watch: {
/* This is left here as an example in case the routes need to be debugged again
'$route' (to, from) {
console.log(this.$window.isSameBaseRoute(from.fullPath, to.fullPath))
$route(to, from) {
this.$log.debug(
this.$window.isSameBaseRoute(from.fullPath, to.fullPath)
)
},
*/
},
mounted() {
this.$log.info("AppMain mounted")
Expand Down
3 changes: 1 addition & 2 deletions src/components/AppNavi.vue
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ export default {
continue
}
if ($this.$refs[`app-navi-cat-${i}`][0].opened) {
// eslint-disable-next-line no-console
console.log(
this.$log.info(
`Reloading recipes in ${
$this.$refs[`app-navi-cat-${i}`][0].title
}`
Expand Down
12 changes: 4 additions & 8 deletions src/components/RecipeEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,7 @@ export default {
$this.allRecipes = response.data
})
.catch((e) => {
// eslint-disable-next-line no-console
console.log(e)
this.$log.error(e)
})
.then(() => {
// finally
Expand Down Expand Up @@ -602,22 +601,19 @@ export default {
// prettier-ignore
t("cookbook","Unknown answer returned from server. See logs.")
)
// eslint-disable-next-line no-console
console.log(e.response)
this.$log.error(e.response)
}
} else if (e.request) {
await showSimpleAlertModal(
t("cookbook", "No answer for request was received.")
)
// eslint-disable-next-line no-console
console.log(e)
this.$log.error(e)
} else {
await showSimpleAlertModal(
// prettier-ignore
t("cookbook","Could not start request to save recipe.")
)
// eslint-disable-next-line no-console
console.log(e)
this.$log.error(e)
}
} finally {
$this.$store.dispatch("setSavingRecipe", {
Expand Down
15 changes: 6 additions & 9 deletions src/components/RecipeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export default {
}

if (this.$store.state.recipe === null) {
// console.log("Recipe is null")
this.$log.debug("Recipe is null")
return recipe
}

Expand Down Expand Up @@ -452,9 +452,9 @@ export default {
},
watch: {
recipe(r) {
// console.log('Recipe has been updated')
this.$log.debug("Recipe has been updated")
if (r) {
// console.log("Recipe", r)
this.$log.debug("Recipe", r)

if (r.description) {
this.parsedDescription = t("cookbook", "Loading…")
Expand All @@ -475,8 +475,7 @@ export default {
this.parsedIngredients.splice(idx, 1, x)
})
.catch((ex) => {
// eslint-disable-next-line no-console
console.log(ex)
this.$log.error(ex)
})
})
} else {
Expand All @@ -493,8 +492,7 @@ export default {
this.parsedInstructions.splice(idx, 1, x)
})
.catch((ex) => {
// eslint-disable-next-line no-console
console.log(ex)
this.$log.error(ex)
})
})
} else {
Expand All @@ -511,8 +509,7 @@ export default {
this.parsedTools.splice(idx, 1, x)
})
.catch((ex) => {
// eslint-disable-next-line no-console
console.log(ex)
this.$log.error(ex)
})
})
} else {
Expand Down
6 changes: 2 additions & 4 deletions src/components/SettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ export default {
.reindex()
.then(() => {
$this.scanningLibrary = false
// eslint-disable-next-line no-console
console.log("Library reindexing complete")
this.$log.info("Library reindexing complete")
if (
["index", "search"].indexOf(this.$store.state.page) > -1
) {
Expand All @@ -265,8 +264,7 @@ export default {
})
.catch(() => {
$this.scanningLibrary = false
// eslint-disable-next-line no-console
console.log("Library reindexing failed!")
this.$log.error("Library reindexing failed!")
})
},

Expand Down
10 changes: 2 additions & 8 deletions src/components/SuggestionsPopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,7 @@ export const suggestionsPopupMixin = {
* Recover suggestions popup on focus
*/
handleSuggestionsPopupFocus(e) {
if (this.verboseDebugLogging) {
// eslint-disable-next-line no-console
console.log("focus", e, JSON.stringify(this.suggestionsData))
}
this.$log.debug("focus", e, JSON.stringify(this.suggestionsData))
if (this.suggestionsData?.blurred) {
this.suggestionsData.blurred = false
}
Expand All @@ -223,10 +220,7 @@ export const suggestionsPopupMixin = {
* Cancel selection if input gets blurred
*/
handleSuggestionsPopupBlur(e) {
if (this.verboseDebugLogging) {
// eslint-disable-next-line no-console
console.log("blur", e, JSON.stringify(this.suggestionsData))
}
this.$log.debug("blur", e, JSON.stringify(this.suggestionsData))
if (!this.suggestionsPopupVisible || !this.$refs.suggestionsPopup) {
return
}
Expand Down
3 changes: 0 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ window.escapeHTML = helpers.escapeHTML
Vue.prototype.$window = window
Vue.prototype.OC = OC

// eslint-disable-next-line no-undef
Vue.prototype.verboseDebugLogging = verboseDebugLogging

// Markdown for Vue
Vue.use(VueShowdown, {
// set default flavor for Markdown
Expand Down
1 change: 0 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function cookbookConfig (env) {
new CleanWebpackPlugin(),
new webpack.DefinePlugin({
'__webpack_use_dev_server__': env.dev_server || false,
'verboseDebugLogging': isDev && (process.env.VERBOSE || false),
}),
],
resolve: {
Expand Down