Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into nialexsan/ts-conver…
Browse files Browse the repository at this point in the history
…sion-fixed-merge-conflicts
  • Loading branch information
nialexsan committed Nov 7, 2023
2 parents ffe5d30 + 8881394 commit fa3db8c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"mode": "pre",
"mode": "exit",
"tag": "typescript",
"initialVersions": {
"@onflow/config": "1.1.2",
Expand Down
1 change: 0 additions & 1 deletion packages/util-encode-key/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const VALID_HASHINGS = new Set([SHA2_256, SHA3_256])

/**
* Encodes a key into a hex string
*
* @param key - The key to encode (DER Hex)
* @param curve - The curve Flow needs to use with your key [ECDSA_P256|ECDSA_secp256k1]
* @param hash - The hashing algorythm Flow needs to use with your key [SHA2_256|SHA3_256]
Expand Down
10 changes: 8 additions & 2 deletions packages/util-logger/src/util-logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
interface IConfig {
get: <T>(key: string) => T;
}

type Config = IConfig & (() => IConfig) | null

// Config dependency injected into logger to break circular dependency
let config: any = null
let config: Config = null
export const setConfig = (_config: any) => {
config = _config
}
Expand Down Expand Up @@ -61,7 +67,7 @@ export const log = async (options: {
always?: boolean
}) => {
const {title, message, level, always} = options
const configLoggerLevel = await config.get("logger.level", LEVELS.warn)
const configLoggerLevel = (await config?.()?.get<number>("logger.level")) ?? LEVELS.warn

// If config level is below message level then don't show it
if (!always && configLoggerLevel < level) return
Expand Down

0 comments on commit fa3db8c

Please sign in to comment.