如何使用C ++代码显示登录和注销日志 [英] How to display Login and Logout Logs using C++ code

查看:105
本文介绍了如何使用C ++代码显示登录和注销日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,



我需要做的是我想以这种格式显示日志: -



(1)对于LogIn: - XYZ,1,799,tds,e86979ff-dea7-4771-8f43-df6a65a25054:2,192.168.32.95。





(2)对于LogOut: - XYZ,9,799,1,192.168.33.99:57809



其中XYZ假设是服务器名称,1代表登录ID,799是userid,tds是假设用户名,之后是最后的事务ID和客户端IP,例如192.168.32.95。同样,logout 9是注销id,799是userid,1是count表示有多少用户退出系统。之后是客户端IP。如何解决这个问题??





任何人都可以提供某种类型的代码。我迫切需要它,我被困在这里。

谢谢。

Hello All,

What i need to do is i want to display the logs in this format like :-

(1)For LogIn:- XYZ,1,799,tds,e86979ff-dea7-4771-8f43-df6a65a25054:2,192.168.32.95.


(2) For LogOut:- XYZ,9,799,1,192.168.33.99:57809

where XYZ suppose is the server name, 1 stands for login id , 799 is userid, tds is suppose user name, and after that it is transaction ID and Client IP at last which is 192.168.32.95 for example.Similarly, for logout 9 is the logout id, 799 is userid, 1 is count means how many users are logged out of the system. And after that follows, Client IP. How to solve this ??


Can anyone provide me with some type of code. I need it urgently, i am stuck over here.
Thanks.

推荐答案

如果你有API登录用户,并将用户注销,然后在成功登录或注销函数调用后,您可以记录用户的数据。我无法确定您用于存储数据的那种方法(GUID,以及您在字符串中使用的Time对象),我建议的是序列化登录数据并注销信息,然后将其保存在文件中(因此,您使用的是为每个成功事务记录数据;通过trasaction我的意思是登录或注销用户的过程)。您可以从网络获取IP地址,登录时间或注销用户,并且可以在您正在使用的框架中生成GUID;你没有指定。



您应该在帖子中包含工作(或错误)代码的基本示例,以便我们进行投资,然后帮助您。这将有助于我们为您提供更好的解决方案。
If you're having the API to login the user, and to log the user out, then upon a successfull login or logout function call, you can log the data of the user. I am unable to determine what sort of method you're using to store the data (that GUID, and the Time object you're using inside the string), what I can suggest is to serialize the data of the login and log out information, and then save it inside the file (which-so-ever you're using to log the data for each successfull transaction; by trasaction I mean process of login or log out for users). You can get the IP address, Time of the login or log out of the user from the network and the GUID can be generated in the framework you're using; which you've not specified.

You are supposed to include a basic example of working (or faulty) code in your post, for us to invesitage and then help you out. It would help us in providing a better solution to you.


这篇关于如何使用C ++代码显示登录和注销日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆