From: Urban Wallasch Date: Tue, 20 Aug 2019 13:19:54 +0000 (+0200) Subject: * Improved plugin logging. X-Git-Tag: v0.1.0~13 X-Git-Url: https://git.packet-gain.de/?a=commitdiff_plain;h=c00eb4ac5285285711efee15f94739763f5428c0;p=ets2_tele.git * Improved plugin logging. * Removed comment cruft. --- diff --git a/shmget.c b/shmget.c index c3f2d5a..8c2ebe1 100644 --- 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 #include diff --git a/teleshmem.cpp b/teleshmem.cpp index fafa584..12f759f 100644 --- a/teleshmem.cpp +++ b/teleshmem.cpp @@ -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(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