3 Star 3 Fork 2

阿债 / KLogger

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

KLogger: A Simple Logging Class For PHP

A project written by Kenny Katzgrau and originally hosted at CodeFury.net. This marks the development of a newer version of KLogger.

About

KLogger is an easy-to-use logging class for PHP. It supports standard log levels like debug, info, warn, error, and fatal. Additionally, it isn't naive about file permissions (which is expected). It was meant to be a class that you could quickly include into a project and have working right away.

The class was written in 2008, but I have since received a number of emails both saying 'thanks' and asking me to add features.

This github project will host the development of the next version of KLogger. The original version of KLogger is tagged as version 0.1, and is available for download here.

Basic Usage

#Need php version >= 5.0
require_once 'KLogger.php';
require_once 'Requests/Requests.php';
Requests::register_autoloader();

KLogger::setRecordClientIP(true);

if (strtoupper($_SERVER['REQUEST_METHOD']) === 'POST') {
    #the remote file log
    $logger = KLogger::instance('KFileLogger', false, '/tmp');
    $logger->fromHttp();
    exit;
}

$log = KLogger::instance('KFileLogger', false, '/var/log/'); # Specify the log directory
#Add a backend, the mysql pdo
$log->addBackend(KLogger::instance('KPDOLogger', false, 'mysql:host=localhost;dbname=test', 
    array('table'=>'t_logs', 'user'=>'root', 'password'=>'')
));
#Add a backend, the remote file log via http post
$log->addBackend(KLogger::instance('KHTTPLogger', false, $_SERVER['PHP SELF']));

$log->info('Returned a million search results'); //Prints to the log file
$log->fatal('Oh dear.'); //Prints to the log file
$log->info('Here is an object', $obj); //Prints to the log file with a dump of the object

Goals

All of KLogger's internal goals have been met (there used to be a list here). If you have a feature request, send it to katzgrau@gmail.com

Why use KLogger?

Why not? Just drop it in and go. If it saves you time and does what you need, go for it! Take a line from the book of our C-code fathers: "build upon the work of others".

Who uses KLogger?

Klogger has been used in projects at:

* The University of Iowa
* The University of Laverne
* The New Jersey Institute of Technology
* Middlesex Hospital in NJ

Additionally, it's been used in numerous projects, both commercial and personal.

Special Thanks

Special thanks to all contributors, which right now includes three people:

Tim Kinnane Brian Fenton Cameron Will

License

The MIT License

Copyright (c) 2008-2010 Kenny Katzgrau katzgrau@gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

空文件

简介

PHP日志,改自Kenny Katzgrau的KLogger 展开 收起
PHP
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/azhai/klogger.git
git@gitee.com:azhai/klogger.git
azhai
klogger
KLogger
master

搜索帮助