-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(next-drupal)!: add public debug() method to DrupalClient
Fixes #668 BREAKING CHANGE: DrupalClient previously had a debug property that indicated if debugging was enabled. This property has been removed and replaced with a debug() method that accepts a string and logs it as a debug message if debugging is enabled.
- Loading branch information
Showing
3 changed files
with
48 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
import type { Logger } from "./types" | ||
|
||
export const LOG_MESSAGE_PREFIX = "[next-drupal][log]:" | ||
export const DEBUG_MESSAGE_PREFIX = "[next-drupal][debug]:" | ||
export const WARN_MESSAGE_PREFIX = "[next-drupal][warn]:" | ||
export const ERROR_MESSAGE_PREFIX = "[next-drupal][error]:" | ||
|
||
// Default logger. Uses console. | ||
export const logger: Logger = { | ||
log(message) { | ||
console.log(`[next-drupal][log]:`, message) | ||
console.log(LOG_MESSAGE_PREFIX, message) | ||
}, | ||
debug(message) { | ||
console.debug(`[next-drupal][debug]:`, message) | ||
console.debug(DEBUG_MESSAGE_PREFIX, message) | ||
}, | ||
warn(message) { | ||
console.warn(`[next-drupal][debug]:`, message) | ||
console.warn(WARN_MESSAGE_PREFIX, message) | ||
}, | ||
error(message) { | ||
console.error(`[next-drupal][error]:`, message) | ||
console.error(ERROR_MESSAGE_PREFIX, message) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters