Skip to content

Commit

Permalink
chore: added missing KDK prefix on some frontend logs
Browse files Browse the repository at this point in the history
  • Loading branch information
claustres committed Dec 4, 2024
1 parent 9e4bc93 commit ff2c226
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions core/client/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ export function createClient (config) {
if (_.has(resource, 'abilities')) resource = undefined

const abilities = (hasUser ? _.get(user, 'abilities') : Store.get('user.abilities'))
logger.debug('Check for abilities ', operation, service, context, resource, abilities)
logger.debug('[KDK] Check for abilities ', operation, service, context, resource, abilities)
if (!abilities) {
logger.debug('Access denied without abilities')
logger.debug('[KDK] Access denied without abilities')
return false
}
let result
Expand All @@ -284,7 +284,7 @@ export function createClient (config) {
const path = api.getServicePath(service, context, false)
result = permissions.hasServiceAbilities(abilities, path)
if (!result) {
logger.debug('Access to service path ' + path + ' denied')
logger.debug('[KDK] Access to service path ' + path + ' denied')
return false
} else if (operation === 'service') {
// When we only check for service-level access return
Expand All @@ -296,9 +296,9 @@ export function createClient (config) {
result = abilities.can(operation)
}
if (!result) {
logger.debug('Access to resource denied')
logger.debug('[KDK] Access to resource denied')
} else {
logger.debug('Access to resource granted')
logger.debug('[KDK] Access to resource granted')
}
return result
}
Expand Down
4 changes: 2 additions & 2 deletions core/client/components/KContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ const availableComponents = computed(() => {
component.isHidden = getVisibility(component, 'hidden', false)
component.isVisible = getVisibility(component, 'visible', true)
if (!_.startsWith(component.name, 'Q')) {
logger.trace(`Loading component ${component.name}`)
logger.trace(`[KDK] Loading component ${component.name}`)
component.instance = loadComponent(component.name)
} else {
logger.trace(`Using component ${component.name}`)
logger.trace(`[KDK] Using component ${component.name}`)
component.instance = component.name
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/client/components/app/KTour.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function getTarget (target) {
// Then retrieve the right index
if (index < elements.length) element = elements[index]
} catch (error) {
logger.debug('Looking for tour target', error)
logger.debug('[KDK] Looking for tour target', error)
}
}
}
Expand All @@ -189,7 +189,7 @@ function getTarget (target) {
try {
element = document.querySelector(target)
} catch (error) {
logger.debug('Looking for tour target', error)
logger.debug('[KDK] Looking for tour target', error)
}
// Do not return invisible target
// FIXME: does not work when element is hidden by parent
Expand Down
2 changes: 1 addition & 1 deletion core/client/components/form/KForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function onFieldRefCreated (reference) {
// Check whether the form is ready
nbReadyFields.value++
if (nbReadyFields.value === fields.value.length) {
logger.debug(`schema ${schema.value.$id} ready`)
logger.debug(`[KDK] schema ${schema.value.$id} ready`)
isReady.value = true
emit('form-ready')
}
Expand Down
2 changes: 1 addition & 1 deletion core/client/composables/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function useSchema () {
schema.value = _.cloneDeep(schemaModule.default)
} else {
// clone the schema object
logger.trace('setting schema ', schemaNameOrObject.$id)
logger.trace('[KDK] setting schema ', schemaNameOrObject.$id)
schema.value = _.cloneDeep(schemaNameOrObject)
}
// filter ther schema
Expand Down
6 changes: 3 additions & 3 deletions core/client/guards.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function beforeGuard (to, from, next) {
for (const guard of guards) {
const result = guard(user, to, from)
if (typeof result === 'string') {
logger.debug('Navigation guard would redirect to route ' + result)
logger.debug('[KDK] Navigation guard would redirect to route ' + result)
if (typeof next === 'function') {
// Guard are used to check if a route is reachable when the user navigate
// but redirection should be handled at the app level to avoid concurrence
Expand All @@ -96,7 +96,7 @@ export function beforeGuard (to, from, next) {
return result
}
} else if (!result) {
logger.debug('Navigation aborted by guard')
logger.debug('[KDK] Navigation aborted by guard')
if (typeof next === 'function') {
return next(false)
} else {
Expand All @@ -105,7 +105,7 @@ export function beforeGuard (to, from, next) {
}
}

logger.debug('Navigation guards passed')
logger.debug('[KDK] Navigation guards passed')
if (typeof next === 'function') {
return next()
} else {
Expand Down
2 changes: 1 addition & 1 deletion core/client/hooks/hooks.logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logger from 'loglevel'

export function log (hook) {
let message = `${hook.type}: ${hook.path} - Method: ${hook.method}`
let message = `[KDK] ${hook.type}: ${hook.path} - Method: ${hook.method}`

if (hook.type === 'error') {
message += `: ${hook.error.message}`
Expand Down
2 changes: 1 addition & 1 deletion core/client/mixins/mixin.base-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const baseEditor = {
const response = await this.getService().create(object, { query })
onServiceResponse(response)
} else {
logger.warn('Invalid editor mode')
logger.warn('[KDK] Invalid editor mode')
}
} catch (error) {
// User error message on operation should be raised by error hook, otherwise this is more a coding error
Expand Down
6 changes: 3 additions & 3 deletions core/client/readers/reader.blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { i18n } from '../i18n.js'
export const BLOBReader = {
read (files, options) {
if (files.length !== 1) {
logger.debug('invalid \'files\' arguments')
logger.debug('[KDK] invalid \'files\' arguments')
return
}
const file = files[0]
logger.debug(`reading Blob file ${file.name}`)
logger.debug(`[KDK] reading Blob file ${file.name}`)
return new Promise((resolve, reject) => {
const reader = new FileReader()
reader.onloadend = () => {
Expand All @@ -28,7 +28,7 @@ export const BLOBReader = {
if (expectedType === 'dataUrl') {
reader.readAsDataURL(file)
} else {
if (expectedType !== 'arrayBuffer') logger.error(`Undefined expected type ${expectedType}. Read as Array buffer.`)
if (expectedType !== 'arrayBuffer') logger.error(`[KDK] Undefined expected type ${expectedType}. Read as Array buffer.`)
reader.readAsArrayBuffer(file)
}
})
Expand Down
4 changes: 2 additions & 2 deletions core/client/readers/reader.csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { i18n } from '../i18n.js'
export const CSVReader = {
read (files, options) {
if (files.length !== 1) {
logger.debug('invalid \'files\' arguments')
logger.debug('[KDK] invalid \'files\' arguments')
return
}
const file = files[0]
logger.debug(`reading CSV file ${file.name}`)
logger.debug(`[KDK] reading CSV file ${file.name}`)
return new Promise((resolve, reject) => {
const reader = new FileReader()
reader.onloadend = () => {
Expand Down
4 changes: 2 additions & 2 deletions core/client/readers/reader.json.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { i18n } from '../i18n.js'
export const JSONReader = {
read (files, options) {
if (files.length !== 1) {
logger.debug('invalid \'files\' arguments')
logger.debug('[KDK] invalid \'files\' arguments')
return
}
const file = files[0]
logger.debug(`reading JSON file ${file.name}`)
logger.debug(`[KDK] reading JSON file ${file.name}`)
return new Promise((resolve, reject) => {
const reader = new FileReader()
reader.onloadend = () => {
Expand Down
4 changes: 2 additions & 2 deletions core/client/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const Time = {
},
startRealtime () {
if (this.isRealtime()) {
logger.warn('Realtime mode is already active')
logger.warn('[KDK] Realtime mode is already active')
return
}
Store.patch('time', { realtime: true })
Expand All @@ -132,7 +132,7 @@ export const Time = {
},
stopRealtime () {
if (!this.isRealtime()) {
logger.warn('Realtime mode is alrady inactive')
logger.warn('[KDK] Realtime mode is alrady inactive')
return
}
Store.patch('time', { realtime: false })
Expand Down

0 comments on commit ff2c226

Please sign in to comment.