Log services: Difference between revisions

No edit summary
Line 12: Line 12:


== OpenLogger ==
== OpenLogger ==
Takes an input u64 value representing a process ID and returns an [[#ILogger]] instance.
== ILogger ==
This is "nn::lm::ILogger".
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || [[#Log]]
|-
| 1 || [3.0.0+] [[#SetDestination]]
|-
| 2 || [20.0.0+] TransmitHashedLog
|-
| 3 || [20.0.0+] DevNotify
|}
=== Log ===
Takes a type-0x21 input buffer containing the message to log.
Will always return successfully.
=== SetDestination ===
Takes an input u32 mask value indicating the logging destinations to send incoming log messages to. This is stored as a global value. The mask entries are as follows:


Takes an input u64 value representing a process ID and returns an [[#ILogger]] instance.
{| class="wikitable" border="1"
|-
! Value || Description
|-
| 1 || TMA
|-
| 2 || UART
|-
| 4 || UART when sleeping
|-
| 0xFFFF || Log to all destinations
|}


= lm:get =
= lm:get =
Line 29: Line 64:
|-
|-
| 2 || [[#GetLog]]
| 2 || [[#GetLog]]
|-
| 100 || [20.0.0+] [[#CreateDevNotificationReceiver]]
|}
|}


Line 41: Line 78:
The flag mentioned above is not checked here, as it is used in a different place (see [[#Logging]])
The flag mentioned above is not checked here, as it is used in a different place (see [[#Logging]])


= ILogger =
== CreateDevNotificationReceiver ==
This is "nn::lm::ILogger".
Takes an input [[#DevNotificationReceiverModuleId]]. Returns an [[#IDevNotificationReceiver]].


{| class="wikitable" border="1"
== IDevNotificationReceiver ==
|-
This is "nn::lm::IDevNotificationReceiver".
! Cmd || Name
|-
| 0 || [[#Log]]
|-
| 1 || [3.0.0+] [[#SetDestination]]
|-
| 2 || [20.0.0+] TransmitHashedLog
|-
| 3 || [20.0.0+] DevNotify
|}


== Log ==
This was added with [20.0.0+].  
 
Takes a type-0x21 input buffer containing the message to log.
Will always return successfully.
 
== SetDestination ==
 
Takes an input u32 mask value indicating the logging destinations to send incoming log messages to. This is stored as a global value. The mask entries are as follows:


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value || Description
! Cmd || Name
|-
| 1 || TMA
|-
| 2 || UART
|-
|-
| 4 || UART when sleeping
| 0 || GetReceiveEvent
|-
|-
| 0xFFFF || Log to all destinations
| 1 || Receive
|}
|}


= LogPacketHeader =
= LogPacketHeader =
This is "nn::lm::detail::LogPacketHeader"
This is "nn::lm::detail::LogPacketHeader".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 102: Line 118:


= LogPacketFlags =
= LogPacketFlags =
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 112: Line 127:
|-
|-
| 4 || LittleEndian
| 4 || LittleEndian
|}
= Binary header =
Binary log files saved in SD card have this extra header (see [[#Logging]])
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x4 || Magic ("hphp")
|-
| 0x4 || 0x1 || Version (1)
|-
| 0x5 || 0x3 || Padding/reserved
|}
|}


Line 147: Line 148:


= LogDataChunkKey =
= LogDataChunkKey =
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 173: Line 173:
|-
|-
| 10 || ProcessName || Process name.
| 10 || ProcessName || Process name.
|}
= DevNotificationReceiverModuleId =
This is "nn::lm::DevNotificationReceiverModuleId". This is an u32.
= Binary header =
Binary log files saved in SD card have this extra header (see [[#Logging]])
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x4 || Magic ("hphp")
|-
| 0x4 || 0x1 || Version (1)
|-
| 0x5 || 0x3 || Padding/reserved
|}
|}


Line 190: Line 207:


= Log packet =
= Log packet =
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 201: Line 217:


= Logging =
= Logging =
LogManager uses two separate threads: a flushing thread and a htcs thread (main thread is handling both IPC and PM module requests):
LogManager uses two separate threads: a flushing thread and a htcs thread (main thread is handling both IPC and PM module requests):