1
0
Fork 0
mirror of https://github.com/rharkor/caching-for-turbo.git synced 2025-06-08 01:37:01 +09:00

refactor: logging

This commit is contained in:
rharkor 2025-04-10 11:53:41 +02:00
parent 519a9df230
commit 38ccb2efe5
8 changed files with 10 additions and 16 deletions

View file

@ -113,7 +113,7 @@ jobs:
#? This step test nothing, the goal is to see if we can fetch an already saved cache from another run
test-action-all-time-cache:
name: GitHub Actions Test (Linux)
name: GitHub Actions Test (All Time Cache)
runs-on: ubuntu-latest
steps:

4
dist/post/index.js generated vendored
View file

@ -25671,9 +25671,7 @@ const path_1 = __nccwpck_require__(6928);
const env_1 = __nccwpck_require__(1363);
exports.serverPort = 41230;
exports.cachePath = 'turbogha_v2';
exports.cachePrefix = core.getInput('cache-prefix')
? `${exports.cachePath}-${core.getInput('cache-prefix')}`
: exports.cachePath;
exports.cachePrefix = core.getInput('cache-prefix') || exports.cachePath;
const getCacheKey = (hash, tag) => `${exports.cachePrefix}${hash}${tag ? `#${tag}` : ''}`;
exports.getCacheKey = getCacheKey;
exports.serverLogFile = env_1.env.RUNNER_TEMP

2
dist/post/index.js.map generated vendored

File diff suppressed because one or more lines are too long

8
dist/setup/index.js generated vendored
View file

@ -126840,7 +126840,7 @@ async function getCache(ctx, hash) {
const client = (0, utils_1.getCacheClient)();
const cacheKey = (0, constants_1.getCacheKey)(hash);
const { data } = await client.query(cacheKey, constants_1.cachePath);
ctx.log.info(`Cache lookup for ${cacheKey}`);
ctx.log.info(`Cache lookup for ${cacheKey} (path: ${constants_1.cachePath})`);
if (!data) {
ctx.log.info(`Cache lookup did not return data`);
return null;
@ -126985,7 +126985,7 @@ function getCacheClient() {
};
const response = await twirpClient.GetCacheEntryDownloadURL(request);
if (!response.ok) {
core.debug(`Cache not found for version ${request.version} of keys: ${keys.join(', ')}`);
core.info(`Cache not found for version ${request.version} of keys: ${keys.join(', ')}`);
return { success: true, data: undefined };
}
core.info(`Cache hit for: ${request.key}`);
@ -127058,9 +127058,7 @@ const path_1 = __nccwpck_require__(16928);
const env_1 = __nccwpck_require__(51363);
exports.serverPort = 41230;
exports.cachePath = 'turbogha_v2';
exports.cachePrefix = core.getInput('cache-prefix')
? `${exports.cachePath}-${core.getInput('cache-prefix')}`
: exports.cachePath;
exports.cachePrefix = core.getInput('cache-prefix') || exports.cachePath;
const getCacheKey = (hash, tag) => `${exports.cachePrefix}${hash}${tag ? `#${tag}` : ''}`;
exports.getCacheKey = getCacheKey;
exports.serverLogFile = env_1.env.RUNNER_TEMP

2
dist/setup/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -53,7 +53,7 @@ export async function getCache(
const client = getCacheClient()
const cacheKey = getCacheKey(hash)
const { data } = await client.query(cacheKey, cachePath)
ctx.log.info(`Cache lookup for ${cacheKey}`)
ctx.log.info(`Cache lookup for ${cacheKey} (path: ${cachePath})`)
if (!data) {
ctx.log.info(`Cache lookup did not return data`)
return null

View file

@ -105,7 +105,7 @@ export function getCacheClient() {
const response = await twirpClient.GetCacheEntryDownloadURL(request)
if (!response.ok) {
core.debug(
core.info(
`Cache not found for version ${request.version} of keys: ${keys.join(
', '
)}`

View file

@ -4,9 +4,7 @@ import { env } from './env'
export const serverPort = 41230
export const cachePath = 'turbogha_v2'
export const cachePrefix = core.getInput('cache-prefix')
? `${cachePath}-${core.getInput('cache-prefix')}`
: cachePath
export const cachePrefix = core.getInput('cache-prefix') || cachePath
export const getCacheKey = (hash: string, tag?: string): string =>
`${cachePrefix}${hash}${tag ? `#${tag}` : ''}`
export const serverLogFile = env.RUNNER_TEMP