/

Deno

ByteHide Logger supports Deno with full TypeScript integration and modern JavaScript features.

Installation

import { Log } from "https://deno.land/x/bytehide_logger/mod.ts";

Basic Setup

// Configure logger
Log.configure({
    projectToken: 'your-project-token',
    logLevel: 'info',
    consoleOutput: true
});

// Start logging
Log.info('Deno application started');

TypeScript Support

interface UserContext {
    userId: number;
    username: string;
}

const userContext: UserContext = {
    userId: 123,
    username: 'john.doe'
};

Log.info('User logged in', {
    context: userContext
});

Environment Variables

// Load from environment
Log.configure({
    projectToken: Deno.env.get('BYTEHIDE_PROJECT_TOKEN'),
    logLevel: Deno.env.get('LOG_LEVEL') || 'info'
});

File Logging

// Requires --allow-write permission
Log.configure({
    projectToken: 'your-project-token',
    fileOutput: {
        enabled: true,
        path: './logs'
    }
});

Permissions

Run with necessary permissions:

deno run --allow-net --allow-env --allow-write app.ts

Best Practices

Deno Best Practices

  • Use TypeScript for better type safety
  • Configure proper permissions for file logging
  • Use environment variables for sensitive configuration
  • Leverage Deno's built-in testing framework
Previous
Browser