Warning

The Coralogix PHP SDK will End of Life(EOL) Feb 1st 2024.
For PHP 7.4+, please use the Coralogix’s PHP OpenTelemetry Instrumentation Documentation instead.

CoralogixLogger

class Coralogix\CoralogixLogger
Class CoralogixLogger
Coralogix logger instance

Properties

Methods

public Coralogix\CoralogixLogger::__construct(string $private_key=NULL, string $app_name=NULL, string $subsystem=NULL, string $category=NULL, bool $sync_time=false)
Initialize Coralogix logger instance and start logger manager
Parameters:
  • $private_key (string) private key for Coralogix account

  • $app_name (string) your application name

  • $subsystem (string) subsystem of your application

  • $category (string) category for log records

  • $sync_time (bool) synchronize local time with Coralogix servers

public static Coralogix\CoralogixLogger::set_debug_mode(bool $debug_mode) bool
Set debug output mode
Parameters:
  • $debug_mode (bool) new debug mode status

Returns:

bool changed debug mode status

public Coralogix\CoralogixLogger::log(int $severity, $message, string $category=NULL, string $class_name="", string $method_name="", string $thread_id="")
Add log record to sending queue
Parameters:
  • $severity (int) log record level

  • $message (string) log record text

  • $category (string) log record category

  • $class_name (string) name of class from which log was sent

  • $method_name (string) name of method from which log was sent

  • $thread_id (string) ID of thread from which log was sent

public Coralogix\CoralogixLogger::debug($message, string $category=NULL, string $class_name="", string $method_name="", string $thread_id="")
Send log message with DEBUG level
Parameters:
  • $message (string) log record text

  • $category (string) log record category

  • $class_name (string) name of class from which log was sent

  • $method_name (string) name of method from which log was sent

  • $thread_id (string) ID of thread from which log was sent

public Coralogix\CoralogixLogger::verbose($message, string $category=NULL, string $class_name="", string $method_name="", string $thread_id="")
Send log message with VERBOSE level
Parameters:
  • $message (string) log record text

  • $category (string) log record category

  • $class_name (string) name of class from which log was sent

  • $method_name (string) name of method from which log was sent

  • $thread_id (string) ID of thread from which log was sent

public Coralogix\CoralogixLogger::info($message, string $category=NULL, string $class_name="", string $method_name="", string $thread_id="")
Send log message with INFO level
Parameters:
  • $message (string) log record text

  • $category (string) log record category

  • $class_name (string) name of class from which log was sent

  • $method_name (string) name of method from which log was sent

  • $thread_id (string) ID of thread from which log was sent

public Coralogix\CoralogixLogger::warning($message, string $category=NULL, string $class_name="", string $method_name="", string $thread_id="")
Send log message with WARNING level
Parameters:
  • $message (string) log record text

  • $category (string) log record category

  • $class_name (string) name of class from which log was sent

  • $method_name (string) name of method from which log was sent

  • $thread_id (string) ID of thread from which log was sent

public Coralogix\CoralogixLogger::error($message, string $category=NULL, string $class_name="", string $method_name="", string $thread_id="")
Send log message with ERROR level
Parameters:
  • $message (string) log record text

  • $category (string) log record category

  • $class_name (string) name of class from which log was sent

  • $method_name (string) name of method from which log was sent

  • $thread_id (string) ID of thread from which log was sent

public Coralogix\CoralogixLogger::critical($message, string $category=NULL, string $class_name="", string $method_name="", string $thread_id="")
Send log message with CRITICAL level
Parameters:
  • $message (string) log record text

  • $category (string) log record category

  • $class_name (string) name of class from which log was sent

  • $method_name (string) name of method from which log was sent

  • $thread_id (string) ID of thread from which log was sent

public Coralogix\CoralogixLogger::__destruct()
Stop logger manager before exit
public Coralogix\CoralogixLogger::get_buffer_size() int
Get size of logs queue
Returns:

int size of logs queue

public Coralogix\CoralogixLogger::flush_messages()
Flush(send) logs queue manually