This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // syslog系统日志写入 | |
| // 记录在/var/log/message中 | |
| #include <stdio.h> | |
| #include <syslog.h> | |
| int main() | |
| { | |
| openlog("bin_name", LOG_PID, LOG_LOCAL0); | |
| syslog(LOG_DEBUG, "A%d", 1); // 默认在日志中看不到 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| /* | |
| 例子: | |
| c := &ChainSortedMap{} | |
| c.comparator = func(o1 interface{}, o2 interface{}) bool { | |
| d1 := o1.(*SA) | |
| d2 := o2.(*SA) | |
| if d1.lv == d2.lv { | |
| return d1.exp > d2.exp |