Overview

Packages

  • tipy

Classes

  • Tipy
  • TipyApp
  • TipyCli
  • TipyCliSession
  • TipyConfig
  • TipyController
  • TipyCookie
  • TipyDAO
  • TipyEnv
  • TipyFlash
  • TipyInflector
  • TipyInput
  • TipyIOWrapper
  • TipyLogger
  • TipyMailer
  • TipyModel
  • TipyOutput
  • TipyRequest
  • TipySession
  • TipyTestCase
  • TipyTestRunner
  • TipyView

Exceptions

  • AssertionFailedException
  • CompileErrorException
  • CompileWarningException
  • CoreErrorException
  • CoreWarningException
  • DeprecatedException
  • NoMethodException
  • NoticeException
  • ParseException
  • RecoverableErrorException
  • StrictException
  • TipyDaoException
  • TipyException
  • TipyModelException
  • TipyRollbackException
  • TipyValidationException
  • UserDeprecatedException
  • UserErrorException
  • UserNoticeException
  • UserWarningException
  • WarningException
  • Overview
  • Package
  • Class
  • Deprecated
  • Todo

Class TipyLogger

Simple Logger

By default TipyLogger writes to STDERR

// This will output to apache's error.log  something like
// Fri Sep 13 12:22:20 2015 [23685] [INFO] Hello World!
$logger = new TipyLogger();
$logger->info('Hello World');

But it is possible to create a logger to write to the file

$logger = new TipyLogger('/var/log/project.log');
$logger->info('Hello World');

Threshold Level

Default threshold level for new TipyLogger is TipyLogger::DEBUG. This means that all messages are logged.

You can change TipyLogger::$threshold to different threshold level and then only messages with lower or equal severity level will be logged.

$logger = new TipyLogger('/var/log/project.log');
$logger->threshold = TipyLogger::WARN;
$logger->warn('I am logged :)'); // logged
$logger->info('I am not :('); // ignored
Package: tipy
Located at src/TipyLogger.php
Methods summary
public
# __construct( string $filePath = 'php://stderr' )

Create new TipyLogger instance

Create new TipyLogger instance

Parameters

$filePath
default 'php://stderr'
public
# setThreshold( string|integer $level )

Set threshold level

Set threshold level

Parameters

$level
public
# log( string $message, integer $level )

Log message

Log message

Parameters

$message
$level
public
# fatal( string $message )

Log FATAL message

Log FATAL message

Parameters

$message
public
# error( string $message )

Log ERROR message

Log ERROR message

Parameters

$message
public
# warn( string $message )

Log WARN message

Log WARN message

Parameters

$message
public
# info( string $message )

Log INFO message

Log INFO message

Parameters

$message
public
# debug( string $message )

Log DEBUG message

Log DEBUG message

Parameters

$message
Constants summary
integer FATAL

An unhandleable error that results in a program crash

An unhandleable error that results in a program crash

# 1
integer ERROR

A handleable error

A handleable error

# 2
integer WARN

A warning

A warning

# 3
integer INFO

Useful information

Useful information

# 4
integer DEBUG

Low-level information for developers

Low-level information for developers

# 5
integer OFF

Logging is turned off

Logging is turned off

# 0
Properties summary
public integer $threshold

Log level threshold

Log level threshold

# TipyLogger::DEBUG
public string $format

Log format. Accepts all strftime characters plus %pid and %level

Log format. Accepts all strftime characters plus %pid and %level

# '%c [%pid] [%level]'
tipy API documentation generated by ApiGen