Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
08582e2
Improved logging, enumerations and more
kleisauke Oct 20, 2016
593c24a
Merge pull request #15 from kleisauke/logging-enumerations
jcupitt Oct 22, 2016
ef0d885
pass PSR2, README updates
jcupitt Oct 22, 2016
a1e2e6e
remove Enum from enum names, version bump
jcupitt Oct 22, 2016
d1727aa
Override __toString() + remove enums import
kleisauke Oct 22, 2016
cc2a01d
add notes on scope to the README
jcupitt Oct 25, 2016
22d2277
add formatted docs to repro
jcupitt Oct 25, 2016
d582081
make tests run in less RAM
jcupitt Oct 25, 2016
02d3c39
better write to file exception test
jcupitt Oct 26, 2016
d91b499
add sig.php example
jcupitt Oct 26, 2016
ff4e79f
move logger
jcupitt Oct 26, 2016
95888ac
all seems to work
jcupitt Oct 26, 2016
e9bee8f
fix sig.php
jcupitt Oct 26, 2016
efd538f
fix some phpcs warnings
jcupitt Oct 26, 2016
706072b
make a separate Logger class
jcupitt Oct 27, 2016
1b44116
move debug/error logging convenience into Main
jcupitt Oct 27, 2016
d0efc5f
fix Logger image->string conversion
jcupitt Oct 27, 2016
a1ad5e3
Merge branch 'add-default-logger' of github.com:jcupitt/php-vips into…
jcupitt Oct 27, 2016
cb42841
remove @version tags
jcupitt Oct 27, 2016
eeb8483
update docs
jcupitt Oct 27, 2016
f4d4fb5
avoid AND/OR member names
jcupitt Oct 27, 2016
6e99cdd
regen docs, again
jcupitt Oct 27, 2016
44c805e
incorporate review comments
jcupitt Oct 27, 2016
e6bd0e5
Merge branch 'dev' into add-default-logger
jcupitt Oct 28, 2016
2e5cc1b
ready to merge to dev
jcupitt Oct 28, 2016
c3ac43d
rename error() and debug()
jcupitt Nov 2, 2016
d63c9da
remove :void return
jcupitt Nov 2, 2016
420b9f4
regen docs
jcupitt Nov 2, 2016
e79da93
update docs without cache files
jcupitt Nov 2, 2016
c00f6af
remove left-over debugLog() etc.
jcupitt Nov 2, 2016
2d7fb28
update docs
jcupitt Nov 2, 2016
d80e827
remove formatted docs, bump to 1.0.0
jcupitt Nov 3, 2016
e0c521b
fixes for review comments
jcupitt Nov 4, 2016
7fd21be
revise README for 1.0
jcupitt Nov 4, 2016
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to `:vips` will be documented in this file.
- logging with PSR-3 Logger Interface [Kleis Auke Wolthuizen]
- switch to PSR2 formatting [Kleis Auke Wolthuizen]
- add sig.php example [John Cupitt]
- add Vips\Image::debugLogger() sample logger [John Cupitt]

### Deprecated
- removed `\Enum` from enum names
Expand Down
34 changes: 29 additions & 5 deletions src/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,35 @@
class Image extends ImageAutodoc implements \ArrayAccess
{

/**
* The logger instance.
*
* @var LoggerInterface
*/
private static $logger;

/**
* Sets a logger.
*
* @param LoggerInterface $logger
*
* @return void
*/
public static function setLogger(LoggerInterface $logger)
{
self::$logger = $logger;
}

/**
* Gets a logger.
*
* @return LoggerInterface $logger|null
*/
public static function getLogger()
{
return self::$logger;
}

/**
* The resource for the underlying VipsImage.
*
Expand Down Expand Up @@ -884,11 +913,6 @@ public static function callBase(

$arguments = array_merge([$name, $instance], $arguments);

/*
echo "after arg composition, arguments = ";
var_dump($arguments);
*/

$arguments = self::unwrap($arguments);
$result = call_user_func_array("vips_call", $arguments);
self::errorIsArray($result);
Expand Down
6 changes: 5 additions & 1 deletion src/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ class Main
private static $logger;

/**
* Sets a logger.
* Sets a logger. This can be handy for debugging. For example:
*
* ```php
* Vips\Main::setLogger(new Vips\Logger);
* ```
*
* @param LoggerInterface $logger
*
Expand Down