MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / logComputationDetails

Function logComputationDetails

packages/logger/src/log.ts:121–188  ·  view source on GitHub ↗
({
    causedBy,
    owner,
    owned,
    sources,
    prev,
    value,
}: Readonly<ComputationState>)

Source from the content-addressed store, hash-verified

119}
120
121export const logComputationDetails = ({
122 causedBy,
123 owner,
124 owned,
125 sources,
126 prev,
127 value,
128}: Readonly<ComputationState>): void => {
129 // Owner
130 if (owner !== UNUSED) {
131 const label = inGray('Owner:')
132 if (!owner) console.log(label, null)
133 else {
134 const {name} = getNodeState(owner)
135 console.log(`${label} %c${name}`, STYLES.grayBackground)
136 }
137 }
138
139 // Value
140 if (value !== UNUSED) console.log(`${inGray('Value =')}${getValueSpecifier(value)}`, value)
141 if (prev !== UNUSED) logPrevValue(prev)
142
143 // Caused By
144 if (causedBy && causedBy.length) {
145 if (causedBy.length === 1) {
146 const cause = causedBy[0]!
147 console.log(
148 `%c${inGray('Caused By:')} %c${cause.name}%c ${inGray('=')}`,
149 '',
150 getNameStyle(cause.type),
151 '',
152 cause.value,
153 )
154 } else {
155 console.groupCollapsed(inGray('Caused By:'), causedBy.length)
156 causedBy.forEach(cause => {
157 console.log(
158 `%c${cause.name}%c ${inGray('=')}`,
159 getNameStyle(cause.type),
160 '',
161 cause.value,
162 )
163 })
164 console.groupEnd()
165 }
166 }
167
168 // Sources
169 if (sources.length) {
170 console.groupCollapsed(inGray('Sources:'), sources.length)
171 sources.forEach(source => {
172 const {type, name} = getNodeState(source)
173 console.log(`%c${name}%c ${inGray('=')}`, getNameStyle(type), '', source.value)
174 })
175 console.groupEnd()
176 } else {
177 console.log(inGray('Sources:'), 0)
178 }

Callers 2

logComputationFunction · 0.85
logOwnedFunction · 0.85

Calls 6

inGrayFunction · 0.85
getNodeStateFunction · 0.85
getValueSpecifierFunction · 0.85
logPrevValueFunction · 0.85
getNameStyleFunction · 0.85
logOwnerListFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…