module Onyx

Overview

Powerful framework for modern applications. See onyxframework.org.

Defined in:

onyx.cr
onyx/logger.cr
onyx/db.cr
lib/onyx-eda/src/onyx-eda.cr
lib/onyx-http/src/onyx-http.cr

Class Method Summary

Class Method Detail

def self.db : DB::Database #

Singleton DB::Database instance. It requires DATABASE_URL environment variable to be set. It would validate the connection on program run with Onyx.db.scalar("SELECT 1") call, raising of failure.


[View source]
def self.db=(db : DB::Database) #

Singleton DB::Database instance. It requires DATABASE_URL environment variable to be set. It would validate the connection on program run with Onyx.db.scalar("SELECT 1") call, raising of failure.


[View source]
def self.logger : Logger #

The singleton Logger instance. It has a custom slim formatter and level depending on CRYSTAL_ENV environment variable:

  • "production" -- INFO
  • "benchmarking" -- FATAL, outputs to dev/null
  • all other (including nil) -- DEBUG
require "onyx/logger"
Onyx.logger.debug("Hello world!")
# DEBUG [12:45:52.520 #13543] Hello world!

[View source]
def self.logger=(logger : Logger) #

The singleton Logger instance. It has a custom slim formatter and level depending on CRYSTAL_ENV environment variable:

  • "production" -- INFO
  • "benchmarking" -- FATAL, outputs to dev/null
  • all other (including nil) -- DEBUG
require "onyx/logger"
Onyx.logger.debug("Hello world!")
# DEBUG [12:45:52.520 #13543] Hello world!

[View source]