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 = {
|
||||
chatKey?: Comparable<Chat, string>
|
||||
labelAssociationKey?: Comparable<LabelAssociation, string>
|
||||
logger: Logger
|
||||
logger?: Logger
|
||||
socket?: WASocket
|
||||
}
|
||||
|
||||
@@ -73,13 +73,12 @@ const predefinedLabels = Object.freeze<Record<string, Label>>({
|
||||
}
|
||||
})
|
||||
|
||||
export default (
|
||||
{ logger, chatKey, labelAssociationKey, socket }: BaileysInMemoryStoreConfig
|
||||
) => {
|
||||
export default (config: BaileysInMemoryStoreConfig) => {
|
||||
// const logger = _logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' })
|
||||
chatKey = chatKey || waChatKey(true)
|
||||
labelAssociationKey = labelAssociationKey || waLabelAssociationKey
|
||||
logger = logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' })
|
||||
const socket = config.socket
|
||||
const chatKey = config.chatKey || waChatKey(true)
|
||||
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 chats = new KeyedDB(chatKey, c => c.id) as KeyedDB<Chat, string>
|
||||
|
||||
Reference in New Issue
Block a user