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

Human-readable (non-ANSI) console output logs #1825

Closed
egabrum opened this Issue Feb 12, 2019 · 7 comments

Comments

Projects
2 participants
@egabrum
Copy link

commented Feb 12, 2019

Versions

ConEmu build: 180626 x64
OS version: Windows 10 x64
Used shell version: cmd and powershell

Problem description

The console output log contains multiple codes that make it unreadable.
Would it be possible to log a stripped-out version of the log?

Steps to reproduce

  1. Enable console output logging.
  2. Open a terminal. Enter a few commands.
  3. Open the log file.

Actual results

�]9;11;"cmd.exe: SetConsoleTextAttribute(0x07)"�\myMachine�]9;11;"hostname.exe: SetConsoleCursorPosition(0,1)"�\
ConEmuAnsiLog: C:\Users\User\Box Sync\mySEsync\myPortable\cmdermini\vendor\conemu-maximus5\Logs\ConEmu-2019-02-12-p38816.log

�[1;32;40m190212-122629 C:\Users\User\Box Sync\mySEsync\myPortable\cmdermini\vendor\conemu-maximus5\Logs  
�]9;11;"cmd.exe: ExtSetAttributes(0x0A)"�\�[1;30;40mλ �[0m�]9;11;"cmd.exe: ExtSetAttributes(0x08)"�\�]9;11;"cmd.exe: ExtSetAttributes(0x07)"�\�]9;11;"cmd.exe: SetConsoleCursorPosition(2,5)"�\l�]9;11;"cmd.exe: SetConsoleCursorPosition(3,5)"�\s�]9;11;"cmd.exe: SetConsoleCursorPosition(4,5)"�\
�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x09)"�\2017�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\/                          �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-25-p11056.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-31-p11140.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-05-p21952.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,7)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x09)"�\2018�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\/                          �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-25-p17772.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-31-p12724.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-05-p29504.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,8)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x09)"�\2019�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\/                          �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-26-p18572.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-31-p15304.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-06-p4768.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,9)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-23-p15740.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-28-p15576.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-31-p17236.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-09-p4828.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,10)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-23-p17680.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-28-p25652.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-31-p3952.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*   �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-11-p31832.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,11)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-23-p8052.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*   �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-29-p25416.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-01-p14016.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-12-p25292.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,12)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-24-p17872.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-29-p7040.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*   �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-04-p18584.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-12-p35164.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,13)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-24-p26092.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-29-p7996.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*   �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-05-p13796.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-12-p38816.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,14)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-24-p31952.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-30-p20112.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-05-p18628.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,15)"�\

�[1;32;40m190212-122638 C:\Users\User\Box Sync\mySEsync\myPortable\cmdermini\vendor\conemu-maximus5\Logs  
�]9;11;"cmd.exe: ExtSetAttributes(0x0A)"�\�[1;30;40mλ �[0m�]9;11;"cmd.exe: ExtSetAttributes(0x08)"�\�]9;11;"cmd.exe: ExtSetAttributes(0x07)"�\�]9;11;"cmd.exe: SetConsoleCursorPosition(2,17)"�\

Expected results

myMachine
ConEmuAnsiLog: C:\Users\User\Box Sync\mySEsync\myPortable\cmdermini\vendor\conemu-maximus5\Logs\ConEmu-2019-02-12-p38816.log

190212-122629 C:\Users\User\Box Sync\mySEsync\myPortable\cmdermini\vendor\conemu-maximus5\Logs
λ ls
2017/                          ConEmu-2019-01-25-p11056.log*  ConEmu-2019-01-31-p11140.log*  ConEmu-2019-02-05-p21952.log*
2018/                          ConEmu-2019-01-25-p17772.log*  ConEmu-2019-01-31-p12724.log*  ConEmu-2019-02-05-p29504.log*
2019/                          ConEmu-2019-01-26-p18572.log*  ConEmu-2019-01-31-p15304.log*  ConEmu-2019-02-06-p4768.log*
ConEmu-2019-01-23-p15740.log*  ConEmu-2019-01-28-p15576.log*  ConEmu-2019-01-31-p17236.log*  ConEmu-2019-02-09-p4828.log*
ConEmu-2019-01-23-p17680.log*  ConEmu-2019-01-28-p25652.log*  ConEmu-2019-01-31-p3952.log*   ConEmu-2019-02-11-p31832.log*
ConEmu-2019-01-23-p8052.log*   ConEmu-2019-01-29-p25416.log*  ConEmu-2019-02-01-p14016.log*  ConEmu-2019-02-12-p25292.log*
ConEmu-2019-01-24-p17872.log*  ConEmu-2019-01-29-p7040.log*   ConEmu-2019-02-04-p18584.log*  ConEmu-2019-02-12-p35164.log*
ConEmu-2019-01-24-p26092.log*  ConEmu-2019-01-29-p7996.log*   ConEmu-2019-02-05-p13796.log*  ConEmu-2019-02-12-p38816.log*
ConEmu-2019-01-24-p31952.log*  ConEmu-2019-01-30-p20112.log*  ConEmu-2019-02-05-p18628.log*

190212-122638 C:\Users\User\Box Sync\mySEsync\myPortable\cmdermini\vendor\conemu-maximus5\Logs
λ
@Maximus5

This comment has been minimized.

Copy link
Owner

commented Feb 12, 2019

Logs were intended to store data from console, generally for reporting purposes. Without codes they would have much less value.

If you want to read them, you may just "print" them to console, e.g. "type ConEmu-...log".

@egabrum

This comment has been minimized.

Copy link
Author

commented Feb 12, 2019

Thanks for the workaround. I'd rather be able to just search/open the logs without post-processing. I'd suggest a switch to select the format of the log. The current format must be very useful for some use cases, but I suspect (just a guess) that the majority of users would default to a plain log format.
But I'll understand if this is not a priority for you.

P.S. Do you know of any editor/viewer that interprets the current log format (presenting it in the same manner it was printed to screen)?

@Maximus5

This comment has been minimized.

Copy link
Owner

commented Feb 13, 2019

@egabrum

This comment has been minimized.

Copy link
Author

commented Feb 14, 2019

Looks like \x1b[^\x1b]+\x1b\\ does the trick.
I haven't lost hope though... ;-)
#1697

@egabrum

This comment has been minimized.

Copy link
Author

commented Feb 17, 2019

So I've gone back to some older logs (I work with logs often, hence my being reluctant to having to post-process them) and found that they used to be pretty readable. They only became not human-readable after this change:
https://conemu.github.io/blog/2018/03/09/Build-180309.html

Write to ANSI Log calls to certain console WinAPI functions. Example: ^[]9;11;"cmd.exe: SetConsoleCursorPosition(0,0)"^[.

Wouldn't it be fair to make this new feature optional for those that were pretty happy with the logging as it was?

@Maximus5 Maximus5 added this to the 190311 milestone Mar 10, 2019

@Maximus5 Maximus5 added the settings label Mar 10, 2019

@Maximus5 Maximus5 added this to To Do in ConEmu via automation Mar 10, 2019

@Maximus5 Maximus5 moved this from To Do to Ready for Testing in ConEmu Mar 24, 2019

DanaMW added a commit to DanaMW/ConEmu that referenced this issue Mar 24, 2019

Merge remote-tracking branch 'upstream/master'
* upstream/master: (50 commits)
  Internal. Restore 2019.3.10 build in WhatsNew
  190324 release files
  190324 Chocolatey and Nuget
  Maximus5gh-1825: Add option to enable/disable ANSI calls to WinApi functions.
  Hooks: Support FillConsoleOutputCharacter and FillConsoleOutputAttribute.
  AnsiLogs: log current system time each 500ms.
  Internal. Remove friend functions
  Internal. Fix cl warning
  Internal. Use \x7 as our specials terminator in logs.
  Maximus5gh-1492: AnsiLog-s location may be specified as a folder or file with `-new_console:L:"Path"`.
  Internal. Return prev char from CEStr::SetAt
  ANSI: Use \x7 as our specials terminator in logs.
  Internal. Fix cl warnings
  Internal. Drop spare comment
  Internal. Use defines intead of magic numbers
  Maximus5gh-622: Fix window size on minimize/restore.
  Internal. PVS false alarm
  Internal. Correct assert condition
  Internal. Format for readability
  Internal. Add `const` qualifiers
  ...
@Maximus5

This comment has been minimized.

Copy link
Owner

commented Mar 25, 2019

190324?

@egabrum

This comment has been minimized.

Copy link
Author

commented Mar 25, 2019

Seems to work like a charm on 190324
Thanks!

@Maximus5 Maximus5 closed this Mar 25, 2019

ConEmu automation moved this from Ready for Testing to Done Mar 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.