katzgrau / KLogger

A Simple Logging Class For PHP
http://codefury.net/projects/klogger/
980 stars 284 forks source link

Using other classes #75

Closed peterlaws closed 8 years ago

peterlaws commented 8 years ago

Where does it say this class uses other classes? Nowhere

onno-vos-dev commented 8 years ago

I'm not really sure what the issue is here? It uses: https://github.com/php-fig/log as the log interface if that's what you're wondering about?

Please explain the issue at hand here?

peterlaws commented 8 years ago

Where does it say you need to download that, from a n00b respective, except within the About section as a link.

onno-vos-dev commented 8 years ago

Composer will take care of that for you :) Just use composer install and everything will be automagically handled for you :)

peterlaws commented 8 years ago

I don't use composer though :)

Also, what is with the 'vendor/autoload.php'? I see no such file, only the 'Logger.php' file, so had to DIY include_once in the correct order.

onno-vos-dev commented 8 years ago

I'd highly suggest you start using composer in that case. It takes care of loading all the dependencies and creating the vendor/autoload.php file for you.

Composer is a pretty wide spread tool within PHP development so you're going to encounter it in other places as well so you might as well start learning. Just do some reading on: https://getcomposer.org/

katzgrau commented 8 years ago

@peterlaws It's pretty common to use 3rd party packages now (in this case, it's not even a package, but an interface nearly every logging lib implements). Dependencies are no longer the exception, but the norm. That goes for nearly every other language too: ruby, python, javascript, yada yada. They each have their own packages and package managers.

If you're interested in the older, standalone version of KLogger, it's at: https://github.com/katzgrau/KLogger/releases/tag/0.2.0

peterlaws commented 8 years ago

Why isn't this writing to the file?

function logging($level = 'DEBUG') {
  $path = '/blah/';
  $level = "Psr\Log\LogLevel::".$level;
  $options = array('dateFormat' => 'd-m-Y G:i:s.u', 'filename' => 'system.log');
  $logger = new Katzgrau\KLogger\Logger($path, $level, $options);
  $logger->error('Test');
  return $logger;
}
katzgrau commented 8 years ago

There could be other reasons, but two obvious ones:

By the way, that first mistake should have generated at least a PHP notice..

Anyway, I don't want to be rude, but these aren't KLogger issues - just issues with knowledge of PHP. Questions like this are probably better addressed on a PHP forum or IRC chat.