luofei614 / socketlog Goto Github PK
View Code? Open in Web Editor NEW微信调试、API调试和AJAX的调试的工具,能将日志通过WebSocket输出到Chrome浏览器的console中
微信调试、API调试和AJAX的调试的工具,能将日志通过WebSocket输出到Chrome浏览器的console中
你这个是基于thinkphp的吗?
RT,如果我在生产环境调试BUG,想进行一定的加密,例如:在chrome插件输入对应秘钥,才可以看到console输出的结果。
可以确定程序只运行了一遍,但是在chrome的console中显示了两遍一模一样的log
配置:
slog(array(
'host'=>'log_server',//websocket服务器地址,默认localhost
'port'=>'1229',//websocket服务器端口,默认端口是1229
'optimize'=>true,//是否显示利于优化的参数,如果运行时间,消耗内存等,默认为false
'show_included_files'=>true,//是否显示本次程序运行加载了哪些文件,默认为false
'error_handler'=>false,//是否接管程序错误,将程序错误显示在console中,默认为false
'force_client_id'=>'',//日志强制记录到配置的client_id,默认为空
'allow_client_ids'=>array('_TEMP')////限制允许读取日志的client_id,默认为空,表示所有人都可以获得日志。
)
,'set_config');
错误信息:
Access to font at 'https://fonts.gstatic.com/s/googlesans/v14/4UaGrENHsxJlGDuGo1OIlL3Owp4.woff2' from origin 'https://developers.google.com' has been blocked by CORS policy: Request header field socketlog is not allowed by Access-Control-Allow-Headers in preflight response.
感觉是触发了跨域限制;
关闭socketlog插件后就不报错了。
kiosk.scr888.com/[运行时间:0.031057119369507s][吞吐率:32.20req/s][内存消耗:3,756,382.50kb]
log.js:18
www.proxy-listen.dehttp://www.proxy-listen.de/azenv.php[运行时间:0.013264179229736s][吞吐率:75.39req/s][内存消耗:1,551,018.68kb]
slog(array(
'host'=>'exampewrewrle.proxy.qqbrowser.cc',//websocket服务器地址,默认localhost
'port'=>'8000',//websocket服务器端口,默认端口是1229
'error_handler'=>false,
'force_client_id'=>'aaa'
),'set_config');
看了代码,里面是直接写死1116的啊
好像就没有这个方法一样
服务端可以做一些配置限制客户端吗,要不然开启这个了服务,所有知道地址的人都能用?
$this->_dbh = new PDO(......);
PDO返回的是一个对象,
slog($this->queryStr,$this->_linkID);
该如何处理呢?
SocketLog started success
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::1229
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at Server._listen2 (net.js:1271:14)
at listen (net.js:1307:10)
at Server.listen (net.js:1403:5)
at Server.listen (/usr/lib/node_modules/socketlog-server/node_modules/nodejs-websocket/Server.js:119:14)
at Object. (/usr/lib/node_modules/socketlog-server/index.js:26:4)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
composer.json修改如下
"autoload": { "psr-4": { "think\\": "php/" } }
不是think\\slog\\
您好,这个插件对于线上调试很方便,然后我有两个问题想请教您,如果方便希望您留意一下:
1)目前服务端是通过 NodeJs 实现的,我想请教下看能不能通过 workman 或 其他框架去实现(这块儿我也不是很懂。。。所以希望通过您这个调试插件去深入了解一下)
2)如果可以通过 workman 实现,那么当 客户端(浏览器插件) 通过 ws 协议连接服务端的时候,服务端是如何识别客户端的呢?(浏览器插件的 client_id 是如何接收的)
调试微信时怎么设置,在浏览器上打开那个链接???
如题
我在 docker
中没有配置成功,能出一份 docker
中使用的教程吗? 😭
工具很好用,在开发环境上运行正常.没有出现过问题.但是:
生产环境下,一直都会有,
New Connection
Connection closed
一直循环,链接一直中断.
是不是 和服务器的配置有关系呢?还是网络的原因?
Could you at least translate the description it in english ?
thanks !
ReadMe
文档中关于Composer
安装SocketLog
的命令书写错误。
原命令为:
composer require luofei614\socketlog
正确应为:
composer require luofei614/socketlog
将反斜杠更改为正斜杠即可,望修改
我看这个日志输出是等SocketLog对象被销毁的时候在析构方法中出发的发送日志, 那么如果我的程序是一个deamon程序的话,程序不结束,那么对象就不自动释放,岂不是一直不能输出日志了~ 那么force_client_id是不是也没啥意义了呢?
slog.php不能自动加载类。Linux下需要和类别大小写一样,才行。
改成Slog.php就ok了
Line 227 in 73964d9
public static function fatalError()
{
// 保存日志记录
if ($e = error_get_last())
{
self::error_handler($e['type'],$e['message'],$e['file'],$e['line']);
self::sendLog();//此类终止不会调用类的 __destruct 方法,所以此处手动sendLog
}
}
http://php.net/manual/en/function.error-get-last.php#113518
[Editor's note: as of PHP 7.0.0 there is error_clear_last() to clear the most recent error.]
需要添加
if (version_compare(PHP_VERSION, '7.0') >= 0){ error_clear_last(); }
Function create_function() is deprecated
Server:socketlog-server已经作为服务器后台的任务无间断运行,
Client:一开始打开google-chrome之后,客户端的console是可以接受到日志信息的.但是,电脑锁屏之后(注意:chrome没有关),再次打开电脑,就接受不到日志的信息了.猜测有可能是windows锁屏期间,关闭了所有的通讯连接,导致客服端连接中断,之后通讯正常,客户端就不能接受log信息.
如题
请问有办法在LINUX下让socketlog-server > /dev/null 这个命令开机自动运行吗?
配置了半天,把php5.2升级到了5.4,消除所有报错之后,chrome控制台没有任何输出,唉,好无奈,是不支持windows 环境么?
1:程序运行时间有时候太快,是0秒,就会报错=》Warning: Division by zero in D:\wamp\www\test3\php\slog.php on line 405
2:extensions::uncaught_exception_handler:8 Error in event handler for (unknown): TypeError: Cannot read property 'tagName' of null
at chrome-extension://anbcgmenmcnofajcnpjjdhpdgndhpfhg/js/content.min.js:1:145
`<?php
// return [
// 'type' => 'SocketLog',
// 'host' => 'localhost',
// //日志强制记录到配置的client_id
// 'force_client_ids' => [ 'abcdefg' ],
// //限制允许读取日志的client_id
// 'allow_client_ids' => [ 'abcdefg' ],
// ];
// +----------------------------------------------------------------------
// | 日志设置
// +----------------------------------------------------------------------
return [
// 默认日志记录通道
'default' => env( 'log.channel', 'socketlog'),
// 日志记录级别
'level' => [],
// 日志类型记录的通道 ['error'=>'email',...]
'type_channel' => [],
// 关闭全局日志写入
'close' => false,
// 全局日志处理 支持闭包
'processor' => null,
// 日志通道列表
'channels' => [
'file' => [
// 日志记录方式
'type' => 'File',
// 日志保存目录
'path' => '',
// 单文件日志写入
'single' => false,
// 独立日志级别
'apart_level' => [],
// 最大日志文件数量
'max_files' => 0,
// 使用JSON格式记录
'json' => false,
// 日志处理
'processor' => null,
// 关闭通道日志写入
'close' => false,
// 日志输出格式化
'format' => '[%s][%s] %s',
// 是否实时写入
'realtime_write' => false,
],
// 其它日志通道配置
'socketlog' => [
'type' => 'SocketLog',
'host' => 'localhost',
//日志强制记录到配置的client_id
'force_client_ids' => [ 'abcdefg' ],
//限制允许读取日志的client_id
'allow_client_ids' => [ 'abcdefg' ],
],
],
];
`
我的是这样的,在网上找了很多资料,不管怎么改,就是不成功。只能来问问大家有在thinkphp6中使用成功的吗
include './php/slog.function.php';
slog(array(
'enable'=>true,//是否打印日志的开关
'host'=>'slog.thinkphp.cn',//websocket服务器地址,默认localhost
'optimize'=>true,//是否显示利于优化的参数,如果运行时间,消耗内存等,默认为false
'show_included_files'=>true,//是否显示本次程序运行加载了哪些文件,默认为false
'error_handler'=>true,//是否接管程序错误,将程序错误显示在console中,默认为false
'force_client_id'=>'',//日志强制记录到配置的client_id,默认为空,就是配置了这个的浏览器如果当前页面是开着的,同样也会接收到日志
'allow_client_ids'=>array('dfb')////限制允许读取日志的client_id,默认为空,表示所有人都可以获得日志。
),'config');
echo 'hello world';
$_GET['id'];
slog('hello world');
有详细的配置教程吗?我怎么配置不成功呀
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.