Skip to content

Commit f95e69f

Browse files
premalathamvskdopen
authored andcommitted
sleepd : Changed free text logging information to KV Pair
:Release Notes: Changed free text logging information to KV Pair :Detailed Notes: Changed free text logging information to KV Pair :Testing Performed: Tested on official build and logs appear in KV pairs in /var/log/messages. :QA Notes: :Issues Addressed: [GF-44127] Sleepd logging valuable information in free text fields Open-webOS-DCO-1.0-Signed-off-by: Premalatha MVS <[email protected]> Change-Id: I01ad828c54e17bd455877022ac19a0207577db61 Reviewed-on: https://g2g.palm.com/3783 Reviewed-by: Build Verification Reviewed-by: Premalatha MVS <[email protected]> Tested-by: Premalatha MVS <[email protected]> Reviewed-by: Keith Derrick <[email protected]>
1 parent 6322504 commit f95e69f

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

include/internal/logging.h

100644100755
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* kvcount - count for key-value pairs
2929
* ... - key-value pairs and free text. key-value pairs are formed using PMLOGKS or PMLOGKFV
3030
* e.g.)
31-
* LOG_CRITICAL(msgid, 2, PMLOGKS("key1", "value1"), PMLOGKFV("key2", "%s", value2), "free text message");
31+
* LOG_CRITICAL(msgid, 2, PMLOGKS("key1", "value1"), PMLOGKFV("key2", "%d", value2), "free text message");
3232
**********************************************/
3333
#define SLEEPDLOG_CRITICAL(msgid, kvcount, ...) \
3434
PmLogCritical(getsleepdcontext(), msgid, kvcount, ##__VA_ARGS__)
@@ -71,7 +71,6 @@
7171
/** timeout_alarm.c */
7272
#define MSGID_RTC_ERR "RTC_ERR" //RTC not working properly
7373
#define MSGID_SELECT_EXPIRY_ERR "SELECT_EXPIRY_ERR" //Failed to select expiry from timeout db
74-
#define MSGID_RTC_ERR "RTC_ERR" //RTC not working properly
7574
#define MSGID_TIMEOUT_MSG_ERR "TIMEOUT_MSG_ERR" //could not send timeout message
7675
#define MSGID_SQLITE_STEP_FAIL "SQLITE_STEP_FAIL" //sqlite3 step error
7776
#define MSGID_SQLITE_FINALIZE_FAIL "SQLITE_FINALIZE_FAIL" //sqlite3 finalize error
@@ -100,7 +99,7 @@
10099
#define MSGID_NAMED_HOOK_LIST_OOM "NAMED_HOOK_LIST_OOM" //Out of memory on initialization
101100

102101
/** timesaver.c */
103-
#define MSGID_TIME_NOT_SAVED_TO_DB "TIME_NOT_SAVED_TO_DB" //time not be saved to db before battery was pulledout
102+
#define MSGID_TIME_NOT_SAVED "TIME_NOT_SAVED" //time not be saved to temp file before battery was pulledout
104103

105104
/** activity.c */
106105

src/alarms/timeout_alarm.c

100644100755
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -952,9 +952,9 @@ _rtc_check(gpointer data)
952952
if (this_time == sLastRTCTime)
953953
{
954954
sNumTimes++;
955-
SLEEPDLOG_WARNING(MSGID_RTC_ERR, 1, PMLOGKFV(NYX_QUERY_TIME, "%ld", this_time),
956-
"RTC appears not to be ticking, number of times showing same RTC time : %ld",
957-
sNumTimes);
955+
SLEEPDLOG_WARNING(MSGID_RTC_ERR, 2, PMLOGKFV(NYX_QUERY_TIME, "%ld", this_time),
956+
PMLOGKFV("RTC_TIME","%ld",sNumTimes),
957+
"RTC appears not to be ticking,showing same RTC time");
958958
}
959959
else
960960
{
@@ -1511,8 +1511,7 @@ _alarms_timeout_init(void)
15111511

15121512
if (!retVal)
15131513
{
1514-
SLEEPDLOG_ERROR(MSGID_DB_OPEN_ERR, 0, "Failed to open database %s",
1515-
timeout_db_name);
1514+
SLEEPDLOG_ERROR(MSGID_DB_OPEN_ERR, 1, PMLOGKS("DBName",timeout_db_name),"Failed to open database");
15161515
goto error;
15171516
}
15181517

src/pwrevents/machine.c

100644100755
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ void MachineSleep(void)
163163
void
164164
MachineForceShutdown(const char *reason)
165165
{
166-
SLEEPDLOG_INFO(MSGID_FRC_SHUTDOWN, 0,
167-
"Pwrevents shutting down system because of %s", reason);
166+
SLEEPDLOG_INFO(MSGID_FRC_SHUTDOWN, 1, PMLOGKS("Reason",reason),
167+
"Pwrevents shutting down system");
168168

169169
#ifdef REBOOT_TAKES_REASON
170170

@@ -194,8 +194,7 @@ MachineForceShutdown(const char *reason)
194194
void
195195
MachineForceReboot(const char *reason)
196196
{
197-
SLEEPDLOG_INFO(MSGID_FRC_REBOOT, 0, "Pwrevents rebooting system because of %s",
198-
reason);
197+
SLEEPDLOG_INFO(MSGID_FRC_REBOOT, 1,PMLOGKS("Reason",reason), "Pwrevents rebooting system");
199198

200199
#ifdef REBOOT_TAKES_REASON
201200

src/pwrevents/shutdown.c

100644100755
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ send_reply(LSHandle *sh, LSMessage *message,
791791
bool retVal;
792792
char *payload;
793793
va_list vargs;
794+
gchar* payloadStr = NULL;
794795

795796
va_start(vargs, format);
796797
payload = g_strdup_vprintf(format, vargs);
@@ -800,8 +801,10 @@ send_reply(LSHandle *sh, LSMessage *message,
800801

801802
if (!retVal)
802803
{
803-
SLEEPDLOG_WARNING(MSGID_LSMSG_REPLY_FAIL, 0,
804-
"Could not send reply with payload : %s", payload);
804+
payloadStr = g_strescape(payload,NULL);
805+
SLEEPDLOG_WARNING(MSGID_LSMSG_REPLY_FAIL, 1,PMLOGKS("payload",payloadStr),
806+
"Could not send reply");
807+
g_free(payloadStr);
805808
}
806809

807810
g_free(payload);

src/utils/timesaver.c

100644100755
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ timesaver_save()
7070

7171
if (file < 0)
7272
{
73-
SLEEPDLOG_WARNING(MSGID_TIME_NOT_SAVED_TO_DB, 0,
74-
"Could not save time to \"%s\"", time_db_tmp);
73+
SLEEPDLOG_WARNING(MSGID_TIME_NOT_SAVED, 1, PMLOGKS("FileName",time_db_tmp), "Could not save time");
7574
}
7675
else
7776
{

0 commit comments

Comments
 (0)