Skip to content

bartee/LoggerUtil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

This Logger is a generic Logging service, to be able to write notes to a file. 

Usage: 
- Download and unzip all in your project.
- In files where you want to use the logger, require the file logging.php from the util's basedir.
- Use LogFactory::get(loggername)->log(yourmessage);
- Each message will be prepended with a timestamp. 
- The log can be autorotated, if you define the constant

CONSTANTS
All constants are defaulted within logging.php
- LOGGING_BASEDIR - Basedir for the Logging-utility codebase.    
- LOG_DIR - the dir where all logs are written to. Should be 0777. Defaults to $_SERVER{'DOCUMENT_ROOT'].'/logs/';
- LOGGING_ACTIVE - if set to false, all logging will be disabled. Useful for generic speedups
- LOG_ROTATION_INTERVAL - The Logger-utility provides for automatic logfile rotation. 
		When the file reaches a specified age or size, it will be renamed - prepending the current date to the file
		OPTIONS:
			- day    : max file age is one day (24h)
			- week   : max file age is one week (7d)
			- month  : max file age is one month(30d)
			- size:# : max file size is #bytes (no abbreviation like MB or so, just the numbers!)

EXTENDING
You can extend the BaseLogger to create your own logfiles. For an example, see the AccessLogger. 
Copy that file AND class to something matching your requirements and enter your own filename.


@license General Public License
@author Bart Stroeken
@package Practisse Utilities
@subpackage LoggingUtil

About

PHP Logging utitlity that provides access to writing a short message to a file. Based on the config, it can autorotate the log based on timestamp or filesize

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages