# Logging

## Logger Class

The `Logger` class is designed to facilitate logging within your application. It provides various log levels to categorize and differentiate the type and severity of log messages.&#x20;

You can use this class to record important information, debug messages, warnings, and errors during the execution of your application.

### Methods

#### `info(format: String, ...args?: any[]): void`

Use this method to log informational messages. It accepts a format string and optional additional arguments that can be interpolated into the format string.&#x20;

These messages are typically used to convey important details about the application's operation.

```typescript
// Log informational message
Logger.info("This is an informational message.");
```

#### `debug(format: String, ...args?: any[]): void`

The `debug` method is intended for logging debugging messages. Like `info`, it also accepts a format string and optional arguments.&#x20;

Debugging messages help developers understand the inner workings of the application and troubleshoot issues during development and testing.

```typescript
// Log debugging message with interpolated argument
var variable = 42;
Logger.debug("Debugging message: %s", variable);
```

#### `warn(format: String, ...args?: any[]): void`

To log warning messages, use the `warn` method. It accepts a format string and optional arguments.&#x20;

Warning messages are crucial for notifying users or developers about potential issues that do not disrupt the application's flow but should be addressed.

```typescript
// Log a warning message
Logger.warn("Warning: Something might be wrong.");
```

#### `error(format: String, ...args?: any[]): void`

The `error` method is designed to log error messages. It accepts a format string and optional arguments.&#x20;

Error messages are essential for identifying critical issues that need immediate attention and resolution. They help pinpoint problems in the application.

```typescript
// Log an error message
Logger.error("Error: Something went terribly wrong.");
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.b2winsuite.com/5.6/scripting/utilities/logging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
