//
//  LogViewController.swift
//  eGauge
//
//  Created by egauge on 10/28/19.
//  Copyright © 2019 egauge. All rights reserved.
//

//  Handle the log buffer popup, used to display the current
//  log and send bug reports
//

import UIKit
import MessageUI

class LogVC: UIViewController
{

var delegate: PopupDelegate!

@IBOutlet weak var LogBuffer: UITextView!

@IBAction func DoneAction(_ sender: Any)
{

    self.dismiss(animated: true, completion: nil)
}

//  viewDidLoad: API to initialize the view
//
//    Do the initial setup for the view and set the displayed
//    string to the contents of the log buffer
//
override func viewDidLoad()
{
    super.viewDidLoad()

    init_data()
}


//  fill_log: extract log buffer into string to display\
//
func fill_log()
{

    LogBuffer.text = ""
    for i in 0 ..< Log.size() {
        LogBuffer.text += "\(i):\(Log.get(i))\n"
    }
}

//  init_data: initialize the data from the log to be displayed
//
func init_data()
{

    fill_log()
}

}
