Documentation

Http extends AbstractWriter
in package

Http log writer class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
5.0.0

Table of Contents

Properties

$client  : Client|null
Stream object
$limit  : string|null
Log limit, stored as the canonical PSR-3 level string

Methods

__construct()  : mixed
Constructor
getClient()  : Client
Get client
getContext()  : string
Get context for log
getLogLimit()  : string|null
Get log limit
hasLogLimit()  : bool
Has log limit
isWithinLogLimit()  : bool
Check if a log level is within the set log level limit
setLogLimit()  : AbstractWriter
Set log limit
writeLog()  : Http
Write to the log
sanitize()  : string
Strip CR/LF from a value before it's written into a delimited/line-based log format, to prevent an embedded newline from forging a fake extra line (or, for writers that build header-style text like Mail's Subject line, a fake extra header).

Properties

$client

Stream object

protected Client|null $client = null

$limit

Log limit, stored as the canonical PSR-3 level string

protected string|null $limit = null

Methods

__construct()

Constructor

public __construct(Client $client) : mixed

Instantiate the Mail writer object

Parameters
$client : Client

getContext()

Get context for log

public getContext([array<string|int, mixed> $context = [] ]) : string
Parameters
$context : array<string|int, mixed> = []
Return values
string

getLogLimit()

Get log limit

public getLogLimit() : string|null
Return values
string|null

hasLogLimit()

Has log limit

public hasLogLimit() : bool
Return values
bool

isWithinLogLimit()

Check if a log level is within the set log level limit

public isWithinLogLimit(string|int $level) : bool
Parameters
$level : string|int
Return values
bool

setLogLimit()

Set log limit

public setLogLimit(string|int $level) : AbstractWriter

Accepts either a PSR-3 level string or a legacy severity int (0-7) for backward compatibility; always normalized and stored as the canonical PSR-3 string.

Parameters
$level : string|int
Return values
AbstractWriter

writeLog()

Write to the log

public writeLog(string $level, string $message[, array<string|int, mixed> $context = [] ]) : Http
Parameters
$level : string
$message : string
$context : array<string|int, mixed> = []
Return values
Http

sanitize()

Strip CR/LF from a value before it's written into a delimited/line-based log format, to prevent an embedded newline from forging a fake extra line (or, for writers that build header-style text like Mail's Subject line, a fake extra header).

protected sanitize(string $value) : string
Parameters
$value : string
Return values
string

        
On this page

Search results