简体   繁体   中英

[+], [-], [i]… Coding Conventions

I have spent time coding a nice console App for windows users. It is 'console-based' so I wanted to make sure it looks professional when displaying messages to the user. I have seen many exploit code or linux codes displaying console information in this manner:

[+] Found 5 Wireless Networks!
[+] Now Commencing Attack...
[-] Couldn't load the dictionary file
....
[i] Your wifi has weak security

This is just an example. I wanted to know if there's a convention in using this [+] etc symbols while displaying messages or taking input in console applications.

I hope this is not silly, I just want my code to look professional coz I have worked hard writing the code.

Not sure if it is a convention as such. But in the example above :

  • [+] seems to be for expected progress indicator logs,

  • [-] for error logs,

  • [i] for informative logs.

Take a look at this answer for detailed description of the standard log-levels. You may want to map additional descriptive characters to each log-level as was done in the above example..

我认为这个(或其他合适的替换字符)不会(或至少不应该)极大地影响人们如何看待您代码的专业水平。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM