* Improved plugin logging.
authorUrban Wallasch <urban.wallasch@freenet.de>
Tue, 20 Aug 2019 13:19:54 +0000 (15:19 +0200)
committerUrban Wallasch <urban.wallasch@freenet.de>
Tue, 20 Aug 2019 13:19:54 +0000 (15:19 +0200)
* Removed comment cruft.

shmget.c
teleshmem.cpp

index c3f2d5a4c34d8847da7443e7c464b52da1a67c63..8c2ebe1bcd4ac1079b963de2d69ed475b3b6a158 100644 (file)
--- a/shmget.c
+++ b/shmget.c
@@ -1,6 +1,5 @@
 // Needed for shared memory and ftruncate:
 #define _POSIX_C_SOURCE 200112L
-//#define _XOPEN_SOURCE 500
 
 #include <stdio.h>
 #include <stdlib.h>
index fafa584de2bb62dc03dbd39d2e0ae82205993765..12f759fc0e408a31658d8391dce71c9328856101 100644 (file)
@@ -522,29 +522,31 @@ SCSAPI_RESULT scs_telemetry_init(const scs_u32_t version, const scs_telemetry_in
     char vlogstr[100];
 
     if ( 0 != log_open() )
-        v100p->common.log( SCS_LOG_TYPE_warning, "[teleshmem] unable to open log file" );
+        v100p->common.log( SCS_LOG_TYPE_warning, "[teleshmem] Unable to open log file!" );
 
     sprintf( vstr, "%u.%02u", (unsigned)SCS_GET_MAJOR_VERSION(version), (unsigned)SCS_GET_MINOR_VERSION(version) );
     sprintf( rvstr, "%u.%02u", (unsigned)SCS_GET_MAJOR_VERSION(version_req), (unsigned)SCS_GET_MINOR_VERSION(version_req) );
-    sprintf( vlogstr, "[teleshmem] got telemetry version %s", vstr );
+    sprintf( vlogstr, "[teleshmem] Got telemetry version %s.", vstr );
     log_print( "Got telemetry version %s.\n", vstr );
     v100p->common.log( SCS_LOG_TYPE_message, vlogstr );
     if ( version != version_req ) {
-        log_print( "Error: Want telemetry version %s, got %s\n", rvstr, vstr );
-        v100p->common.log( SCS_LOG_TYPE_warning, "[teleshmem] telemetry version not supported" );
+        log_print( "Error: Want telemetry version %s, got %s!\n", rvstr, vstr );
+        v100p->common.log( SCS_LOG_TYPE_warning, "[teleshmem] Telemetry version not supported!" );
         return SCS_RESULT_unsupported;
     }
 
     const scs_telemetry_init_params_v101_t *const version_params = static_cast<const scs_telemetry_init_params_v101_t *>(params);
 
     if ( !init_shm() ) {
-        log_print( "FATAL: Unable to initialize shared memory\n" );
-        version_params->common.log(SCS_LOG_TYPE_error, "[teleshmem] Unable to initialize shared memory");
+        log_print( "FATAL: Unable to initialize shared memory!\n" );
+        version_params->common.log(SCS_LOG_TYPE_error, "[teleshmem] Unable to initialize shared memory!");
         return SCS_RESULT_generic_error;
     }
     lock_shm();
     telemetry->version = TELE_VERSION;
     telemetry->paused = true;
+    log_print("Initialized shared memory\n");
+    version_params->common.log(SCS_LOG_TYPE_message, "[teleshmem] Initialized shared memory.");
 
     // Check application version. Note that this example uses fairly basic channels which are likely to be supported
     // by any future SCS trucking game however more advanced application might want to at least warn the user if there