\phpWTL\LogWriter\FLWFileLogWriterExt

File log writer extension for W3C Extended log file format (FLWext). Takes care of meta-data (directives). Might be used for other purposes as well, where header data must be written one-off at the beginning of a logfile.

Summary

Methods
Properties
Constants
__construct()
writeToLog()
existsLogfile()
writeToLogExt()
$state
$error
$warning
WRITER_PREFIX
SETTINGS_INI_PATH
USER_INI_PATH
PW_STRENGTH
initWriter()
getLogfileLocation()
prepareHtaccessProtection()
prepareLogDirectory()
setIniKeyDefault()
validateIniKey()
getLogTimestamp()
writeDirectivesToLog()
$ready
$eolMethod
$eolSequence
$_EOL
$logsPath
$baseName
$timestampFormat
$rotationPolicy
$loginUser
$loginPwHash
$htaccessProtection
$log_timestamp
$document_root
$full_logs_path
N/A
No private methods found
No private properties found
N/A

Constants

WRITER_PREFIX

WRITER_PREFIX

Prefix for ini files.

SETTINGS_INI_PATH

SETTINGS_INI_PATH

Path for main configuration file.

USER_INI_PATH

USER_INI_PATH

Path for credentials configuration file.

PW_STRENGTH

PW_STRENGTH

Minimum length for a password.

Properties

$state

$state : 

Type

$error

$error : 

Type

$warning

$warning : 

Type

$ready

$ready : 

Type

$eolMethod

$eolMethod : 

Type

$eolSequence

$eolSequence : 

Type

$_EOL

$_EOL : 

Type

$logsPath

$logsPath : 

Type

$baseName

$baseName : 

Type

$timestampFormat

$timestampFormat : 

Type

$rotationPolicy

$rotationPolicy : 

Type

$loginUser

$loginUser : 

Type

$loginPwHash

$loginPwHash : 

Type

$htaccessProtection

$htaccessProtection : 

Type

$log_timestamp

$log_timestamp : 

Type

$document_root

$document_root : 

Type

$full_logs_path

$full_logs_path : 

Type

Methods

__construct()

__construct(string  $inifile = null) 

Parameters

string $inifile

Name/path for custom configuration file.

Examples

See "FLW-default.ini" for a detailed description.
** File not found : ./LogWriter/FLW/FLW-default.ini **

writeToLog()

writeToLog(string  $entry) 

Write a log line to a file

Parameters

string $entry

The string to write (representing a logfile line).

existsLogfile()

existsLogfile() : boolean

Check if logfile exists

Returns

boolean

writeToLogExt()

writeToLogExt(string  $entry, mixed  $directives) 

Write a log line to a file, write header information (e.g. directives for W3C Extended) at start if logfile doesn't exist yet.

Parameters

string $entry

The string to write (representing a logfile line).

mixed $directives

The (single) string or array of strings to write.

initWriter()

initWriter(string  $inifile = null) 

Initialize the writer.

Parameters

string $inifile

Config. file.

getLogfileLocation()

getLogfileLocation() : string

Get logfile location

Returns

string

prepareHtaccessProtection()

prepareHtaccessProtection() 

Create .htacces and .htpasswd to protect logs directory (if configured).

prepareLogDirectory()

prepareLogDirectory() 

Create logs directory.

setIniKeyDefault()

setIniKeyDefault(string  $key) 

Load configuration default values.

Parameters

string $key

Config. entry name.

validateIniKey()

validateIniKey(string  $key, string  $value = null) : array

Parse configuration values.

Set default value for key if given value is null.

Parameters

string $key

Config. entry name.

string $value

Value to validate..

Returns

array —

Configuration errors.

getLogTimestamp()

getLogTimestamp() 

writeDirectivesToLog()

writeDirectivesToLog(array  $directives) 

Write extended directive lines to a file

Parameters

array $directives

The strings to write.