@todo fix me!
v1.0.1
  • Get Started
  • Templates
  • GitHub
  • Overview
  • B24Hook
  • Methods
  • callMethod
  • callFastListMethod
  • fetchListMethod
  • callBatch
  • callBatchByChunk
  • getTargetOrigin
  • getTargetOriginWithPath
  • getLogger
  • setLogger
  • destroy
  • getHttpClient
  • offClientSideWarning
  • Getters
  • auth
  • isInit
  • b24ui
  • b24icons
v1.0.1
  • Docs
  • Frame
  • Hook
  • OAuth
  • Templates

B24Hook.getLogger()

Returns a LoggerInterface from a B24Hook instance.
B24Hook
TypeB24

@todo

The B24Hook object is intended exclusively for use on the server.
  • A webhook contains a secret access key, which MUST NOT be used in client-side code (browser, mobile app).
  • For the client side, use B24Frame.

Usage

getLogger(): LoggerBrowser

Returns the current LoggerInterface.

If the logger wasn't set via setLogger(), the method will return a NullLogger instance, which logs only errors.

Example

import { B24Hook } from '@bitrix24/b24jssdk'

const $b24 = B24Hook.fromWebhookUrl('https://your_domain.bitrix24.com/rest/1/xxxx/')
const loggerFromB24 = $b24.getLogger()

loggerFromB24.log('Processing', 'some value')
loggerFromB24.info('Initializing module...')
loggerFromB24.warn('It is not recommended to use the outdated method.')
loggerFromB24.error('Operation execution error', { code: 500 })

Next Steps

Core API methods:

  • callMethod() — Call any REST API method
  • callBatch() — Batch execution of up to 50 commands

Working with lists:

  • callFastListMethod() — Automatic retrieval of all list pages
  • fetchListMethod() — Incremental loading of large lists via generator

Advanced scenarios:

  • callBatchByChunk() — Batch execution of any number of commands with automatic chunking

getTargetOriginWithPath

Use B24Hook.getTargetOriginWithPath() to get Bitrix24 address with endpoint path. Works only in server environment.

setLogger

Use this method to configure detailed logging during development.

On this page

  • Usage
  • Example
  • Next Steps
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24