# LogParams Class

> Defines the parameters for writing error messages to a log file.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.2.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/LogParams
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/llms.txt

```cpp
class LogParams
```

**Namespace:** `datalogics_interface`

## Description

The messages include the date and time, the source of the error, and the error type: debug, info, warning, error, or fatal. This class also defines the log file name and path.

**Referenced by:** [`Library`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/Library.md)

**Uses types:** [`LogOutputFlags`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/enum/LogOutputFlags.md)

## Constructors

### LogParams

```cpp
datalogics_interface::LogParams::LogParams()
```

*constructor*

The LogParams object contains all settings required for logging. The log output, log file name and log string format can be configured with it.

### LogParams

```cpp
datalogics_interface::LogParams::LogParams(const LogParams &other)
```

*constructor*

**Parameters**

- `other` ([`const LogParams &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/LogParams.md))

Copy constructor.

### LogParams

```cpp
datalogics_interface::LogParams::LogParams(LogParams &&) noexcept
```

*constructor*

**Parameters**

- (unnamed) ([`LogParams &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/LogParams.md))

### ~LogParams

```cpp
datalogics_interface::LogParams::~LogParams()
```

*destructor*

## Methods

### get_log_file_name

```cpp
std::string datalogics_interface::LogParams::get_log_file_name() const
```

**Returns:** `std::string`

Path to the file to write the log to.

Gets the path to the file to write the log to.

### get_log_format

```cpp
std::string datalogics_interface::LogParams::get_log_format() const
```

**Returns:** `std::string`

string Log record format.

NOTE: PDFL supports the following markers to form output string:

"%d" - current date (mmddyyyy). Example: 07292013 "%t" - current time (hhmmss). Example: 121311 "%s" - error source. Example: "DLFramework" "%e" - error type. It can be debug, info, warning, error, fatal. The value which will be output within this marker depends on severity value. It always outputs "error" string.

"%m" - error message. Example: "Exception: InExistent.pdf: This file
cannot be found. Error number: 1074397201" "%T" - full date. It contains current date, current time and the timezone (yyyy-mm- ddThh:mm:ss+/-hh:mm). Example: 2013-07-29T12:13:11+03:00

By default "%T | %s | %e | %m" string format is used.

### get_log_output_flags

```cpp
LogOutputFlags datalogics_interface::LogParams::get_log_output_flags() const
```

**Returns:** [`LogOutputFlags`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/enum/LogOutputFlags.md)

currently used flags.

Supported types of logging are: console, file and Event Log (for Windows only). The outputs can be mixed by ORing corresponding flags. It is also possible to suppress any logging using LogOutputFlags::None.

### operator=

```cpp
LogParams & datalogics_interface::LogParams::operator=(const LogParams &other)
```

**Parameters**

- `other` ([`const LogParams &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/LogParams.md))

**Returns:** [`LogParams &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/LogParams.md)

Copy assignment.

### operator=

```cpp
LogParams & datalogics_interface::LogParams::operator=(LogParams &&) noexcept
```

**Parameters**

- (unnamed) ([`LogParams &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/LogParams.md))

**Returns:** [`LogParams &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/LogParams.md)

### set_log_file_name

```cpp
void datalogics_interface::LogParams::set_log_file_name(const std::string &file_name)
```

**Parameters**

- `file_name` (`const std::string &`): Path to the file to write the log to.

**Returns:** `void`

NOTE: Ignored if LogOuputFlag::File flag is not set.

### set_log_format

```cpp
void datalogics_interface::LogParams::set_log_format(const std::string &format)
```

**Parameters**

- `format` (`const std::string &`): string Log record format.

**Returns:** `void`

NOTE: PDFL supports the following markers to form output string:

"%d" - current date (mmddyyyy). Example: 07292013 "%t" - current time (hhmmss). Example: 121311 "%s" - error source. Example: "DLFramework" "%e" - error type. It can be debug, info, warning, error, fatal. The value which will be output within this marker depends on severity value. Currently it always outputs "error" string.

"%m" - error message. Example: "Exception: InExistent.pdf: This file
cannot be found. Error number: 1074397201" "%T" - full date. It contains current date, current time and the timezone (yyyy-mm- ddThh:mm:ss+/-hh:mm). Example: 2013-07-29T12:13:11+03:00

By default "%T | %s | %e | %m" string format is used.

### set_log_output_flags

```cpp
void datalogics_interface::LogParams::set_log_output_flags(LogOutputFlags flags)
```

**Parameters**

- `flags` ([`LogOutputFlags`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/enum/LogOutputFlags.md)): the flags containing outputs to write the log to.

**Returns:** `void`

Supported types of logging are: console, file and Event Log (for Windows only). The outputs can be mixed by ORing corresponding flags. It is also possible to suppress any logging using LogOutputFlags::None.
