Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用日志类型为 TLOG_SCREEN_COLOR时,文件输出上面有乱码 #13

Open
2873468182 opened this issue Jan 12, 2024 · 8 comments

Comments

@2873468182
Copy link

image
Screenshot from 2024-01-12 11-12-26

@pymumu
Copy link
Owner

pymumu commented Jan 12, 2024

@2873468182
Copy link
Author

试试这个文件吧 https://github.com/pymumu/smartdns/blob/master/src/tlog.c https://github.com/pymumu/smartdns/blob/master/src/tlog.h

你好,我本地尝试了这两个文件,但是在使用该类型时TLOG_SCREEN_COLOR,还是存在文件中有乱码的情况呢

@pymumu
Copy link
Owner

pymumu commented Jan 12, 2024

你怎么获取的文件,你说的这些乱码是颜色控制字符

tlog自己写的文件是不包含控制字符的,除非你用什么捕获了屏幕输出

@2873468182
Copy link
Author

你怎么获取的文件,你说的这些乱码是颜色控制字符

tlog自己写的文件是不包含控制字符的,除非你用什么捕获了屏幕输出

Screenshot from 2024-01-12 14-28-56

你好,我为了使用tlog,首先用宏定义了tlog,然后使用方式是这样的。
tlog_init("/home/yy/vs-project/example_code_project/tinylog/example.log", 1024 * 1024, 8, 0, TLOG_SCREEN_COLOR);
tlog_setlevel(TLOG_DEBUG);
TLOG_DEGUG("This is a debug message.");
TLOG_NOTICE("This is a notice message.");
TLOG_WARN("This is a warn message.\n");
TLOG_ERROR("This is a error message.\n");
TLOG_FATAL("This is a fatal message.\n");
我想请问一下,这个颜色控制字符能否在TLOG_SCREEN_COLOR模式下,不输出到文件中呢?

@pymumu
Copy link
Owner

pymumu commented Jan 12, 2024

试试最新代码,修正了一个地方。

@2873468182
Copy link
Author

试试最新代码,修正了一个地方。

你好,现在可以了,谢谢了!!!

@pymumu
Copy link
Owner

pymumu commented Jan 14, 2024

漏改了一个地方,用最新代码

@2873468182
Copy link
Author

漏改了一个地方,用最新代码
收到,谢谢了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants