mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Make "logger" optional (#772)
This commit is contained in:
@@ -29,7 +29,7 @@ export const waLabelAssociationKey: Comparable<LabelAssociation, string> = {
|
|||||||
export type BaileysInMemoryStoreConfig = {
|
export type BaileysInMemoryStoreConfig = {
|
||||||
chatKey?: Comparable<Chat, string>
|
chatKey?: Comparable<Chat, string>
|
||||||
labelAssociationKey?: Comparable<LabelAssociation, string>
|
labelAssociationKey?: Comparable<LabelAssociation, string>
|
||||||
logger: Logger
|
logger?: Logger
|
||||||
socket?: WASocket
|
socket?: WASocket
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,13 +73,12 @@ const predefinedLabels = Object.freeze<Record<string, Label>>({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export default (
|
export default (config: BaileysInMemoryStoreConfig) => {
|
||||||
{ logger, chatKey, labelAssociationKey, socket }: BaileysInMemoryStoreConfig
|
|
||||||
) => {
|
|
||||||
// const logger = _logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' })
|
// const logger = _logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' })
|
||||||
chatKey = chatKey || waChatKey(true)
|
const socket = config.socket
|
||||||
labelAssociationKey = labelAssociationKey || waLabelAssociationKey
|
const chatKey = config.chatKey || waChatKey(true)
|
||||||
logger = logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' })
|
const labelAssociationKey = config.labelAssociationKey || waLabelAssociationKey
|
||||||
|
const logger: Logger = config.logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' })
|
||||||
const KeyedDB = require('@adiwajshing/keyed-db').default
|
const KeyedDB = require('@adiwajshing/keyed-db').default
|
||||||
|
|
||||||
const chats = new KeyedDB(chatKey, c => c.id) as KeyedDB<Chat, string>
|
const chats = new KeyedDB(chatKey, c => c.id) as KeyedDB<Chat, string>
|
||||||
|
|||||||
Reference in New Issue
Block a user