Module: NRSER::Log::Types

Extended by:
tt::Factory
Defined in:
lib/nrser/log/types.rb

Overview

Note:

This module is NOT required when loading NRSER::Log, and it NEVER should be! It is here for other gems and apps that depend on NRSER to use.

Core logging should have the absolute minimal dependencies, because it’s pretty much always going to be loaded and nothing it depends on can use it when loading up.

Types for logging type things.

Class Method Summary collapse

Class Method Details

.LogLevel(**options) ⇒ Type

A member of SemanticLogger::LEVELS.

Parameters:

  • options (Hash)

    Passed to Type#initialize.

Returns:

  • (Type)


53
54
55
56
57
58
# File 'lib/nrser/log/types.rb', line 53

def_type        :LogLevel,
  aliases:      [ :level ],
  from_s:       ->( string ) { string.to_sym },
&->( **options ) do
  t.In SemanticLogger::LEVELS, **options
end

.StdIO(**options) ⇒ Type

An IO instance with Type#from_s mapping:

'$stdio'  -> $stdio
'$stderr' -> $stderr
'STDOUT'  -> STDOUT
'STDERR'  -> STDERR

Parameters:

  • options (Hash)

    Passed to Type#initialize.

Returns:

  • (Type)


74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/nrser/log/types.rb', line 74

def_type        :StdIO,
  aliases:      [ :stdio ],
  from_s:       ->( string ) {
                  case string
                  when '$stdout'
                    $stdout
                  when '$stderr'
                    $stderr
                  when 'STDOUT'
                    STDOUT
                  when 'STDERR'
                    STDERR
                  end
                },
&->( **options ) do
  t.IsA IO, **options
end