Codeunit 70623694 EOS004 App Logger

Codeunit 70623694 EOS004 App Logger

Provides a framework for logging messages from apps to multiple underlying loggers.

Methods

Reset

procedure Reset()

Resets the logger, removing all configuration and cached data.


Initialize

procedure Initialize(AppId: Guid; Category: Text): Boolean

Initializes the logger with the specified app and category.

Parameters / Return Value

  • AppId Guid

    The app id.

  • Category Text[]

    The category.

  • Returns Boolean

    true if the logger was actually initialized, false if it already was initialized.


Initialize

procedure Initialize(App: ModuleInfo; Category: Text): Boolean

Initializes the logger with the specified app and category.

Parameters / Return Value

  • App ModuleInfo

    The app.

  • Category Text[]

    The category.

  • Returns Boolean

    true if the logger was actually initialized, false if it already was initialized.


AutoFlushLimit

procedure AutoFlushLimit(): Integer

Parameters / Return Value

  • Returns Integer

AutoFlushLimit

procedure AutoFlushLimit(NewValue: Integer)

Parameters / Return Value

  • NewValue Integer

InitializeFromCaller

procedure InitializeFromCaller(Category: Text): Boolean

Initializes the logger from the calling app and the given category.

Parameters / Return Value

  • Category Text[]

    The category.

  • Returns Boolean

    true if the logger was actually initialized, false if it already was initialized.


LogMessage

procedure LogMessage(EventId: Text; Message: Text)

Logs a message to all underlying loggers with the specified event id and message.

Parameters / Return Value

  • EventId Text[]

    The event id.

  • Message Text[]

    The message.


LogMessage

procedure LogMessage(EventId: Text; Message: Text; Payload: Dictionary of [Text, Text])

Logs a message to all underlying loggers with the specified event id and message. Includes additional properties through the payload.

Parameters / Return Value

  • EventId Text[]

    The event id.

  • Message Text[]

    The message.

  • Payload Dictionary[Text,Text]

    The additional properties payload.


LogMessage

procedure LogMessage(EventId: Text; Message: Text; Verbosity: Verbosity; DataClassification: DataClassification; Scope: TelemetryScope)

Logs a message to all underlying loggers with the specified properties.

Parameters / Return Value

  • EventId Text[]

    The event id.

  • Message Text[]

    The message.

  • Verbosity Verbosity

    The verbosity.

  • DataClassification DataClassification

    The data classification.

  • Scope TelemetryScope

    The scope.


LogMessage

procedure LogMessage(EventId: Text; Message: Text; Verbosity: Verbosity; DataClassification: DataClassification; Scope: TelemetryScope; Payload: Dictionary of [Text, Text])

Logs a message to all underlying loggers with the specified properties.

Parameters / Return Value

  • EventId Text[]

    The event id.

  • Message Text[]

    The message.

  • Verbosity Verbosity

    The verbosity.

  • DataClassification DataClassification

    The data classification.

  • Scope TelemetryScope

    The scope.

  • Payload Dictionary[Text,Text]

    The additional properties payload.


IsEnabled

procedure IsEnabled(): Boolean

Specifies whether there exist any enabled underlying loggers. If this instance has not yet been initialized, this will always return false.

Parameters / Return Value

  • Returns Boolean

    true if there exist any enabled underlying loggers, false otherwise.


CollectLogCategories

procedure CollectLogCategories(AppId: Guid; var TempLogCategory: Record "EOS004 App Log Category")

Collects all log categories for the specified app. This method can be called even if the instance has not been initialized.

Parameters / Return Value

  • AppId Guid

    The app id.

  • TempLogCategory Record "EOS004 App Log Category"

    Will contain all categories for the given app.


Flush

procedure Flush(): Integer

Flushes all underlying loggers.

Parameters / Return Value

  • Returns Integer

    The total number of log entries that were flushed.


Events

OnCollectLogCategories

local procedure OnCollectLogCategories(AppId: Guid; var TempLogCategory: Record "EOS004 App Log Category")

Raised when collecting log categories for the specified app. Subscribe to this to provide categories your app can log to. You must provide at least one non-empty category in order for your app to be usable by this logger framework.

Parameters / Return Value

  • AppId Guid

    The Id of the app for which categories are requested.

  • TempLogCategory Record "EOS004 App Log Category"

    The record containing the log categories for the app.



EOS Labs -