gzLogger 0.1 reviewDownload
gzLogger is a simple PHP5 library that allows the user to log information to compressed flat files with an approximate size defined b
gzLogger is a simple PHP5 library that allows the user to log information to compressed flat files with an approximate size defined by the user.
As the user adds data, the library compresses the data and writes it to flat files. When a file reaches a user defined size, the old log file is closed and a new one opened.
gzLogger project is aimed more at PHP CLI applications then web-pages. Also, this code is alpha quality, the API could change, anything could change.
How It Works:
The gzLogger library is the compression side of the package. The gzLogger object allows you to define fine how you want the information compressed. When you intialize the object, you can define these seven settings:
File Tag (DEFAULT: gzLog) - This defines the base name of the compressed files. For example, setting file tag to "gzLogger_ex" would cause the compressed files to be named gzLogger_ex.0, gzLogger_ex.1, etc.
Log Dir (DEFAULT: ./) - The directory you would like the compressed files written to.
Compression Level - The level of compression, from 0 to 9, with 9 being the highest compression. The compression is done using the Zlib library, and the files created with this library can be unzipped using the gzip package found on Unix, Linux, and most other operating systems.
Flush Max (DEFAULT: 100) - The number of add() or log() calls before the data is written to the compressed file. This is done to reduce the number of times the disk is written to.
Max File Size (1MB) - The approximate size of the compressed file before the file is closed and a new one opened. The size of the file is checked when the Flush Max is reached and the data is compressed and written to the file. The Max File Size can be set using bytes, KB (kilobytes), MB (megabytes), and GB (gegabytes). Examples would be: "100″ - 100 bytes, "3KB" - 3 kilobytes, "40MB" - 40 megabytes.
File Suffix (DEFAULT: .gz) - The string on the end of the file name.
Force Commit (DEFAULT: FALSE) - You must set this to TRUE when your writing very small chunks of data (1KB) to the compressed file, and the Max File Size is set low (EX. 20KB). Most operating systems cache small chunks of data and wait until they have enough data to write to the file, and when the data is cached instead of written, the function that checks the file size will return and incorrect value. If you are writing large chunks of data to the file, then leave this set to FALSE.
function gzLogger(File Tag, Log Dir, Compression Level, Flush Max, Max File Size, File Suffix, Force Commit)
What's New in This Release:
Initial release of the software with a basic implementation of most of the core features.
gzLogger 0.1 keywords