---
name: "App::CELL::Log"
section: "3pm"
platform: "linux"
package: "libapp-cell-perl"
version: "0.231-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/App::CELL::Log"
---

# App::CELL::Log(3pm)

the Logging part of CELL

## NAME

App::CELL::Log - the Logging part of CELL

## SYNOPSIS

```
    use App::CELL::Log qw( $log );
    # set up logging for application FooBar -- need only be done once
    $log->init( ident => 'FooBar' );
    # do not suppess 'trace' and 'debug' messages
    $log->init( debug_mode => 1 );
    # do not append filename and line number of caller
    $log->init( show_caller => 0 );
    # log messages at different log levels
    my $level = 'warn'  # can be any of the levels provided by Log::Any
    $log->$level ( "Foobar log message" );
    # the following App::CELL-specific levels are supported as well
    $log->ok       ( "Info-level message prefixed with 'OK: '");
    $log->not_ok   ( "Info-level message prefixed with 'NOT_OK: '");
    # by default, the caller's filename and line number are appended
    # to suppress this for an individual log message:
    $log->debug    ( "Debug-level message", suppress_caller => 1 );
    # Log a status object (happens automatically when object is
    # constructed)
    $log->status_obj( $status_obj );
    # Log a message object
    $log->message_obj( $message_obj );
```

## EXPORTS

This module provides the following exports:

- $log - App::CELL::Log singleton

  ## PACKAGE VARIABLES

- $ident - the name of our application

  - $show\_caller - boolean value, determines if caller information is displayed in log messages

  - $debug\_mode - boolean value, determines if we display debug messages

  - $log - App::CELL::Log singleton object

  - $log\_any\_obj - Log::Any singleton object

  - @permitted\_levels - list of permissible log levels

  ## DESCRIPTION

App::CELL's logs using Log::Any. This `"App::CELL::Log"` module exists to: (1) provide documentation, (2) store the logging category (`$ident`), (3) store the Log::Any log object, (4) provide convenience functions for logging 'OK' and 'NOT\_OK' statuses.

## METHODS

### debug\_mode

If argument provided, set the `$debug_mode` package variable. If no argument, simply return the current debug-mode setting. Examples:

```
    $log->debug_mode(0); # turn debug mode off
    $log->debug_mode(1); # turn debug mode on
    print "Debug mode is on\n" if $log->debug_mode;
```

### ident

Set the `$ident` package variable and the Log::Any category

### show\_caller

Set the `$show_caller` package variable

### permitted\_levels

Access the `@permitted_levels` package variable.

### init

Initializes (or reconfigures) the logger. Although in most cases folks will want to call this in order to set `"ident"`, it is not required for logging to work. See App::CELL::Guide for instructions on how to log with  App::CELL.

Takes PARAMHASH as argument. Recognized parameters:

- "ident" Ω- (i.e., category) string, e.g. 'FooBar' for the FooBar application, or 'CELLtest' if none given

  - "show\_caller" Ω- sets the $show\_caller package variable (see above)

  - "debug\_mode" Ω- sets the $debug\_mode package variable (see above)

  Always returns 1.

### DESTROY

For some reason, Perl 5.012 seems to want a DESTROY method

### AUTOLOAD

Call Log::Any methods after some pre-processing

### status\_obj

Take a status object and log it.
