refactor: use console.info for log consistency and clean up deprecated code

This commit is contained in:
2026-04-17 19:16:13 +02:00
parent 3b074977ed
commit 542a99d23a
6 changed files with 7 additions and 23 deletions

View File

@@ -159,18 +159,6 @@ You can configure scheduled maintenance windows for individual monitors, suspend
**Syntax** **Syntax**
Each monitor supports a `maintenance` array, with one or more objects specifying a `start` and `end` timestamp in UTC ISO8601 format. Each monitor supports a `maintenance` array, with one or more objects specifying a `start` and `end` timestamp in UTC ISO8601 format.
```yaml
- name: 'web-api'
type: http
target: 'https://example.com/health'
maintenance:
- start: '2026-05-10T23:00:00Z'
end: '2026-05-11T01:00:00Z'
- start: '2026-06-01T02:00:00Z'
end: '2026-06-01T03:30:00Z'
alerts: ['default']
```
**Behavior** **Behavior**
- At any time when `now` (UTC) is within a window, the monitor is shown as "maintenance": - At any time when `now` (UTC) is within a window, the monitor is shown as "maintenance":
@@ -411,7 +399,7 @@ npm run check:pages # pages (astro check + tsc)
- [ ] Add support for TLS checks (certificate validity, expiration). Apparently, the Workers API does not support certificate data access, even at the socket level. An external service may be required. - [ ] Add support for TLS checks (certificate validity, expiration). Apparently, the Workers API does not support certificate data access, even at the socket level. An external service may be required.
- [ ] Refine the status page to look... well... less IA generated. - [ ] Refine the status page to look... well... less IA generated.
- [x] Per-monitor maintenance windows (docs and config example added) - [x] Per-monitor maintenance windows
- [ ] Initial support for incident management (manual status overrides, incident timeline). - [ ] Initial support for incident management (manual status overrides, incident timeline).
- [x] Branded status page (simple custom banner). - [x] Branded status page (simple custom banner).
- [ ] Add support for notifications other than webhooks. - [ ] Add support for notifications other than webhooks.

View File

@@ -32,7 +32,7 @@ export async function handleAggregation(env: Env): Promise<void> {
await deleteOldRawData(env.DB, now); await deleteOldRawData(env.DB, now);
await deleteOldHourlyData(env.DB, now); await deleteOldHourlyData(env.DB, now);
console.warn( console.info(
JSON.stringify({ JSON.stringify({
event: 'aggregation_complete', event: 'aggregation_complete',
hour: new Date(hourStart * 1000).toISOString(), hour: new Date(hourStart * 1000).toISOString(),

View File

@@ -131,7 +131,7 @@ const worker = {
}) })
); );
console.warn( console.info(
JSON.stringify({ JSON.stringify({
event: 'scheduled_complete', event: 'scheduled_complete',
checks: checks.length, checks: checks.length,
@@ -161,7 +161,7 @@ async function executeCheck(check: CheckRequest, env: Env): Promise<CheckResult>
// If region is specified and we have Durable Object binding, run check from that region // If region is specified and we have Durable Object binding, run check from that region
if (check.region && env.REGIONAL_CHECKER_DO) { if (check.region && env.REGIONAL_CHECKER_DO) {
try { try {
console.warn( console.info(
JSON.stringify({ event: 'regional_check_start', monitor: check.name, region: check.region }) JSON.stringify({ event: 'regional_check_start', monitor: check.name, region: check.region })
); );
@@ -186,7 +186,7 @@ async function executeCheck(check: CheckRequest, env: Env): Promise<CheckResult>
// Ignore kill errors - Durable Object will be garbage collected // Ignore kill errors - Durable Object will be garbage collected
} }
console.warn( console.info(
JSON.stringify({ JSON.stringify({
event: 'regional_check_complete', event: 'regional_check_complete',
monitor: check.name, monitor: check.name,
@@ -216,7 +216,7 @@ async function executeCheck(check: CheckRequest, env: Env): Promise<CheckResult>
} }
async function executeLocalCheck(check: CheckRequest): Promise<CheckResult> { async function executeLocalCheck(check: CheckRequest): Promise<CheckResult> {
console.warn(JSON.stringify({ event: 'local_check_start', monitor: check.name })); console.info(JSON.stringify({ event: 'local_check_start', monitor: check.name }));
switch (check.type) { switch (check.type) {
case 'http': { case 'http': {
return executeHttpCheck(check); return executeHttpCheck(check);

View File

@@ -1,2 +0,0 @@
// Temporary import for next edit
import { isInMaintenance } from '../utils/maintenance.js';

View File

@@ -6,7 +6,7 @@ import type { CheckRequest, CheckResult } from '../types.js';
export class RegionalChecker extends DurableObject { export class RegionalChecker extends DurableObject {
async runCheck(check: CheckRequest): Promise<CheckResult> { async runCheck(check: CheckRequest): Promise<CheckResult> {
console.warn(JSON.stringify({ event: 'regional_check_run', monitor: check.name })); console.info(JSON.stringify({ event: 'regional_check_run', monitor: check.name }));
try { try {
// Execute the check locally in this Durable Object's region // Execute the check locally in this Durable Object's region

View File

@@ -1,7 +1,5 @@
--- ---
import type { ApiMonitorStatus } from '@worker/types'; import type { ApiMonitorStatus } from '@worker/types';
// Allow maintenance as a valid runtime state:
type MonitorStatus = ApiMonitorStatus['status'] | 'maintenance';
import UptimeBars from './UptimeBars.astro'; import UptimeBars from './UptimeBars.astro';
interface Props { interface Props {