Difference between revisions of "Program Examples:sys log"
| Line 15: | Line 15: | ||
</pre> | </pre> | ||
where '50' is the number of lines that will be printed from the end of the file. | where '50' is the number of lines that will be printed from the end of the file. | ||
| − | + | [[Image:sys_log.PNG||display last 20 lines of sys.log]] | |
==Sending strings to sys.log== | ==Sending strings to sys.log== | ||
Globally load the MC library SYSLOG.LIB. | Globally load the MC library SYSLOG.LIB. | ||
Invoke the function<br/> | Invoke the function<br/> | ||
MC_BASIC_SYS_LOG(MC_BASIC_LOG_MODULE, debug_level, log_str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) | MC_BASIC_SYS_LOG(MC_BASIC_LOG_MODULE, debug_level, log_str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) | ||
Revision as of 08:40, 31 December 2014
'sys.log' is a Linux logger that allows the programmer to document strings while his program is running. We've enabled this feature in MC-Basic context as well.
Printing sys.log
To print sys.log do the following:
1. Connect to the softMC using ssh or serial console.
2. To print the entire log, type in the Linux terminal:
-bash-3.2$ cat /var/sys.log
or
3. To print the last few lines, type in the Linux terminal:
-bash-3.2$ tail -50 /var/sys.log
where '50' is the number of lines that will be printed from the end of the file.
Sending strings to sys.log
Globally load the MC library SYSLOG.LIB.
Invoke the function
MC_BASIC_SYS_LOG(MC_BASIC_LOG_MODULE, debug_level, log_str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)