a-blog cms PHP API Reference

Logger
in package

Table of Contents

Properties

$destinationPath  : string
$json  : stdClass

Methods

addMessage()  : mixed
メッセージを追加
addPercentage()  : mixed
addProcessLog()  : mixed
canceled()  : mixed
中止要求を受けて打ち切ったことを記録する
error()  : mixed
エラー処理
getDestinationPath()  : string
Getter $destinationPath
getJson()  : stdClass
Get json object
getPercentage()  : int
init()  : mixed
初期化
isProcessing()  : bool
処理中か判定
load()  : mixed
ファイルからロード
setDestinationPath()  : mixed
Setter $destinationPath
setExtra()  : void
進捗JSONへ任意のフィールドを追加する
success()  : mixed
成功時
terminate()  : mixed
終了処理
warning()  : mixed
警告処理ログを追加する
build()  : mixed
JSON出力

Properties

$destinationPath

protected string $destinationPath = ''

Methods

addMessage()

メッセージを追加

public addMessage(string $message[, int|float $percentage = 0 ][, int $status = 1 ][, bool $log = true ]) : mixed
Parameters
$message : string
$percentage : int|float = 0

進捗の加算量。件数で割った端数を渡す呼び出し元があるため float も受ける

$status : int = 1
$log : bool = true

addPercentage()

public addPercentage([int $percentage = 0 ]) : mixed
Parameters
$percentage : int = 0

addProcessLog()

public addProcessLog(mixed $message[, mixed $status = 1 ]) : mixed
Parameters
$message : mixed
$status : mixed = 1

canceled()

中止要求を受けて打ち切ったことを記録する

public canceled(string $message) : mixed

進捗表示が完了とも失敗とも区別して「中止しました」と出せるよう、success・error とは別に持つ。

Parameters
$message : string

error()

エラー処理

public error(mixed $message) : mixed
Parameters
$message : mixed

getDestinationPath()

Getter $destinationPath

public getDestinationPath() : string
Return values
string

getJson()

Get json object

public getJson() : stdClass
Return values
stdClass

getPercentage()

public getPercentage() : int
Return values
int

init()

初期化

public init() : mixed

isProcessing()

処理中か判定

public isProcessing() : bool
Return values
bool

load()

ファイルからロード

public load() : mixed

setDestinationPath()

Setter $destinationPath

public setDestinationPath(string $path) : mixed
Parameters
$path : string

setExtra()

進捗JSONへ任意のフィールドを追加する

public setExtra(string $key, mixed $value) : void

common.logger は複数のバックグラウンド処理(CSVインポート・WXRエクスポート・WebP変換等)で 共有されるため、特定の処理だけが必要とする付加情報(CSVインポートの failedRowsAvailable 等)は 固定プロパティとして持たず、呼び出し側がこのメソッドで都度追加する。

Parameters
$key : string
$value : mixed

success()

成功時

public success() : mixed

terminate()

終了処理

public terminate() : mixed

warning()

警告処理ログを追加する

public warning(string $message) : mixed

error() と異なり、全体を打ち切り扱い($this->json->error の設定・percentage=100)には せず、処理は継続しつつ利用者に注意喚起したい場合に使う。

Parameters
$message : string

build()

JSON出力

protected build() : mixed

        
On this page

Search results