# ECFileLoggingWriter

## Abstract

Writes logging entries into a file. Supports logging roation.

## Discussion

The implementation allows the configuration of

- filename
- scheme for the suffix used to copy the current logging file due to rotation. The scheme allows the usage of date formatting entries. Refer to NSDate for describtion of the specifiers
- limitation of the size of a logging file

## Methods

`-checkFilestatus`
  Internal method used to open/create files or to look for log rotation
`-closeAndMoveFile`
  Internal method used to close and move the current logging file
`-createBackupFilename`
  Internal method used create a non-existing backup file name
`-openFile`
  Internal method used to open or create and open a file if necessary
`-setBackupFilenameSuffix:`
  Specifies the suffix which is used when renaming the logging file due to rotation. By default "%Y%m%d%H%M%S" ECFileLoggingWriter_DEFAULT_BACKUSUFFIX is used.
`-setBaseFilename:`
  speficies the fully qualified name for the logging file
`-setEncoding:`
  Specifies the encoding for the logging file. By default the encoding NSASCIIStringEncoding is being used. Refer to the documentation of NSString for further information about encodings
`-setLogBackzpFilename`
  Specifies the suffix which is used when renaming the logging file due to rotation. By default "%Y%m%d%H%M%S" ECFileLoggingWriter_DEFAULT_BACKUSUFFIX is used.
`-setMaxFilesize:`
  Specifies the maximum number of bytes per logging file
`-writeLog:`
  called in order to write the given string somewhere on mother earth

### checkFilestatus

Internal method used to open/create files or to look for log rotation

>     - checkFilestatus;

method result
  self

### closeAndMoveFile

Internal method used to close and move the current logging file

>     - closeAndMoveFile;

method result
  self

### createBackupFilename

Internal method used create a non-existing backup file name

>     - (NSString *) createBackupFilename;

method result
  non-existing backup file name

### openFile

Internal method used to open or create and open a file if necessary

>     - openFile;

method result
  self

### setBackupFilenameSuffix:

Specifies the suffix which is used when renaming the logging file due to rotation. By default "%Y%m%d%H%M%S" ECFileLoggingWriter_DEFAULT_BACKUSUFFIX is used.

See Also:

> setLogBackzpFilename

>     - setBackupFilenameSuffix: (NSString *) aBackupFilename;

##### Parameter Descriptions

> `aBackupFilename`
>   may contain date formatting specifiers. Internally this string is passed to [NSDate descriptionWithCalendarFormat::]

### setBaseFilename:

speficies the fully qualified name for the logging file

>     - setBaseFilename: (NSString *) aBaseFilename;

##### Parameter Descriptions

> `aBaseFilename`
>   fully qualified name for the logging file

method result
  self

### setEncoding:

Specifies the encoding for the logging file. By default the encoding NSASCIIStringEncoding is being used. Refer to the documentation of NSString for further information about encodings

>     - setEncoding: (NSStringEncoding) anEncoding;

method result
  self

### setLogBackzpFilename

Specifies the suffix which is used when renaming the logging file due to rotation. By default "%Y%m%d%H%M%S" ECFileLoggingWriter_DEFAULT_BACKUSUFFIX is used.

See Also:

> setBackupFilenameSuffix:

>     - setBackupFilenameSuffix: (NSString *) aBackupFilename;

##### Parameter Descriptions

> `aBackupFilename`
>   may contain date formatting specifiers. Internally this string is passed to [NSDate descriptionWithCalendarFormat::]

method result
  self

### setMaxFilesize:

Specifies the maximum number of bytes per logging file

>     - setMaxFilesize: (unsigned int) nrBytes;

##### Parameter Descriptions

> `nrBytes`
>   the file writer will create the next file after have been written more then nrBytes.

method result
  self

##### Discussion

By default a maximum size of 4KB (ECFileLoggingWriter_DEFAULT_MAXFILESIZE) is assumed.

### writeLog:

called in order to write the given string somewhere on mother earth

>     - writeLog: (NSString *) logEntry;

method result
  self

(Last Updated August 27, 2006)