Changeset 4951 for trunk/psLib/test/sys
- Timestamp:
- Sep 6, 2005, 2:15:51 PM (21 years ago)
- Location:
- trunk/psLib/test/sys
- Files:
-
- 2 edited
-
tst_psLogMsg.c (modified) (5 diffs)
-
tst_psTrace.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/sys/tst_psLogMsg.c
r4547 r4951 7 7 #include "pslib_strict.h" 8 8 #include "psTest.h" 9 #include <unistd.h> 10 #include <fcntl.h> 9 11 10 12 static psS32 testLogMsg00(); … … 176 178 { 177 179 psS32 i = 0; 178 FILE* file; 179 char line[256]; 180 // FILE* file; 181 int fd; 182 // char line[256]; 180 183 181 184 printf("--------------- psLogSetDestination(PS_LOG_NONE) ----------------\n"); 182 psLogSetDestination("none"); 185 // psLogSetDestination("none"); 186 psLogSetDestination(0); 183 187 for (i=0;i<10;i++) { 184 188 psLogMsg(__func__, i, "Hello World! My level is %d\n", i); … … 186 190 187 191 printf("------------- psLogSetDestination(PS_LOG_TO_STDERR) -------------\n"); 188 psLogSetDestination("dest:stderr"); 192 // psLogSetDestination("dest:stderr"); 193 psLogSetDestination(2); 189 194 for (i=0;i<10;i++) { 190 195 psLogMsg(__func__, i, "Hello World! My level is %d\n", i); … … 192 197 193 198 printf("------------- psLogSetDestination(PS_LOG_TO_STDOUT) -------------\n"); 194 psLogSetDestination("dest:stdout"); 195 for (i=0;i<10;i++) { 196 psLogMsg(__func__, i, "Hello World! My level is %d\n", i); 197 } 199 // psLogSetDestination("dest:stdout"); 200 psLogSetDestination(1); 201 for (i=0;i<10;i++) { 202 psLogMsg(__func__, i, "Hello World! My level is %d\n", i); 203 } 204 198 205 printf("--------------- psLogSetDestination(""file:log.txt"") ---------------\n"); 199 psLogSetDestination("file:log.txt"); 200 for (i=0;i<10;i++) { 201 psLogMsg(__func__, i, "Hello World! My level is %d\n", i); 202 } 203 204 psLogSetDestination("none"); 206 fd = creat("log.txt", 0666); 207 // psLogSetDestination("file:log.txt"); 208 psLogSetDestination(fd); 209 for (i=0;i<10;i++) { 210 psLogMsg(__func__, i, "Hello World! My level is %d\n", i); 211 } 212 213 214 // psLogSetDestination("none"); 215 FILE *file; 216 char line[257]; 217 // psLogSetDestination(-1); 218 psLogSetDestination(0); 205 219 printf("--------------------- The Contents of log.txt -------------------\n"); 206 220 file = fopen("log.txt","r"); … … 209 223 } 210 224 fclose(file); 211 225 close(fd); 226 227 int fd2 = creat("/eva/log.txt", 0666); 212 228 printf("--------------- psLogSetDestination(""file:/eva/log.txt"") ----------\n"); 213 psLogSetDestination("file:/eva/log.txt"); 229 // psLogSetDestination("file:/eva/log.txt"); 230 psLogSetDestination(fd2); 214 231 for ( i=0;i<10;i++) { 215 232 psLogMsg(__func__, i, "Hello World! My level is %d\n", i); 216 233 } 217 218 return 0; 219 } 234 close(fd2); 235 236 return 0; 237 } -
trunk/psLib/test/sys/tst_psTrace.c
r4944 r4951 103 103 (void)psTraceSetLevel(".A.B.C.D.E", 5); 104 104 105 psTrace(".A.C.D.C",1," You should not see this.\n");106 psTrace(".A.B.C.D.E",2," You should see this.\n");107 psTrace(".A.B.C.D.E.F",3," You should see this too.\n");105 psTrace(".A.C.D.C",1," ","You should not see this.\n"); 106 psTrace(".A.B.C.D.E",2," ","You should see this.\n"); 107 psTrace(".A.B.C.D.E.F",3," ","You should see this too.\n"); 108 108 109 109 psTracePrintLevels(); … … 208 208 209 209 (void)psTraceSetLevel(".", 4); 210 psTrace(".", 5, " (0) This message should not be displayed (%x)\n",210 psTrace(".", 5, " ", "(0) This message should not be displayed (%x)\n", 211 211 0xbeefface); 212 212 (void)psTraceSetLevel(".", 7); 213 psTrace(".", 5, " (0) This message should be displayed (%x)\n",213 psTrace(".", 5, " ", "(0) This message should be displayed (%x)\n", 214 214 0xbeefface); 215 215 216 216 (void)psTraceSetLevel(".a", 4); 217 psTrace(".a", 5, " (1) This message should not be displayed (%x)\n",217 psTrace(".a", 5, " ", "(1) This message should not be displayed (%x)\n", 218 218 0xbeefface); 219 219 (void)psTraceSetLevel(".a", 7); 220 psTrace(".a", 5, " (1) This message should be displayed (%x)\n",220 psTrace(".a", 5, " ", "(1) This message should be displayed (%x)\n", 221 221 0xbeefface); 222 222 223 223 224 224 (void)psTraceSetLevel(".a.b", 4); 225 psTrace(".a.b", 5, " (2) This message should not be displayed (%x)\n",225 psTrace(".a.b", 5, " ", "(2) This message should not be displayed (%x)\n", 226 226 0xbeefface); 227 227 (void)psTraceSetLevel(".a.b", 7); 228 psTrace(".a.b", 5, " (2) This message should be displayed (%x)\n",228 psTrace(".a.b", 5, " ", "(2) This message should be displayed (%x)\n", 229 229 0xbeefface); 230 230
Note:
See TracChangeset
for help on using the changeset viewer.
