Coder Social home page Coder Social logo

php-logger-class's Introduction

PHP file logger

A small PHP logger library to easily log notices, warnings, error or fatal errors with a timestamp into a log file.

See tests/index.php for examples.

php-logger-class's People

Contributors

gehaxelt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-logger-class's Issues

Enhancement suggestions

  1. Be more specific in the param documentation:
    1. $logfile - what is this? A relative path to somewhere? An absolute path? Just a file name in a default dir?
    2. $messageType - the param is optional, mention that. And explain, which values are valid for this (the constants)
  2. Why do you have the constants as integers? The code to output the message uses a big "switch" statement - but the only thing that differs in all the cases is the $messageType. If you put the "Notice" and all the rest (e.g. "!!!FATAL!!!") in the values of the constants, you could save a lot of space.
  3. Why do you have the $now Variable in getTime - why do you have getTime at all? date() is just as good.
  4. What about locking the file? What happens if multiple applications try to write in the same file?
  5. "fclose(fopen($fileName,"w"));" WTF? Why not just use "a" as the mode on fopen and leave out the createLogFile function alltogether?
  6. Why does openLogfile (a bit surprisingly despite of the documentation) close the log file?
  7. fopen does not throw an exception, it generates an E_WARNING user. Is that really catchable?
  8. Where are the unit tests?
  9. Why do you use a first uppercase letter in method names? Standard-compliant is lowercase beginning of the method name.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.